Git Product home page Git Product logo

objc2swift's Introduction

objc2swift

demo.gif

Try the online version at objc2swift.yahoo-labs.jp

Project Goal

We created objc2swift for our own good, to reduce the redundant task when rewriting Obj-C code to Swift.

Generally, rewriting process consists of two phases: first simply replacing the syntax from Obj-C to Swift, then adopting new features that are introduced to Swift.

objc2swift is aimed at reducing the first half of the process, so that we can focus more on the creative / intellectual work.

Please do not expect complete conversion.

Features

  • Merges @interface and @implementation and create a single Swift class.
  • Converts properties, including those that have it's own getter/setter in the implementation.
  • Converts message-send to method-call.
  • Converts init-process such as [[MyThing alloc] initWithThing:...] into MyThing(thing: ...).
  • Converts corresponding types and functions: NSInteger -> Int, NSLog -> print
  • ...and more!

Quick Start

CLI

Build jar:

$ git clone https://github.com/yahoojapan/objc2swift.git
$ cd objc2swift
$ ./gradlew jar

Create an alias, and pass the Obj-C source files you want to convert.

$ alias objc2swift='java -jar /path/to/objc2swift/build/libs/objc2swift-1.0.jar'
$ objc2swift src/test/resources/sample.*

WEB-UI

Install typesafe-activator, and run.

$ brew install typesafe-activator
$ cd web/
$ activator run

Access localhost:9000, and there you are!

Developer's Guide

objc2swift is made with ANTLR. More detail coming soon.

LICENSE

This software is released under the MIT License, see LICENSE.txt.

objc2swift's People

Contributors

taketo1024 avatar xuwei-k avatar ynky-sb avatar ynuchida avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.