![]() ![]() It is currently capable of translating many of the main features one might expect - classes, structs, enums, closures, extensions, protocols, etc - enough that it currently translates around 97% of a version of its own codebase (the other 3% are platform-specific files). Gryphon's support for Swift features is constantly evolving. Can I translate anything written in Swift? ![]() Gryphon attempts to find a "reasonably understandable Kotlin" middle ground somewhere between "machine-code-like Kotlin" and "perfectly idiomatic Kotlin". This is done within some realistic constraints: the priority is that the translated code has to behave correctly, for instance. As a rule, if you understand the input Swift code, you should also be able to understand the translated Kotlin code - if you don't, feel free to file a bug report. One of Gryphon's main goals is to make sure translated code can be understood by human beings. Will I be able to understand the translated code? It's still possible technically to generate Kotlin code that doesn't compile - for instance, if you try to translate unsupported Swift features, or if there's a bug - but as a rule, you should be able to translate, compile and run supported code without the need for post-translation edits. Gryphon's output code is meant to behave just like the input code that created it. Can I compile and run the translated code or do I need to fix it first? It was especially designed to enable app developers to translate platform-independent parts of their iOS apps into code they can use in their Android apps. ![]() Gryphon is a command line application that can translate Swift code into Kotlin code. There are also more advanced guides on using collections, using translation comments, and using templates □ Frequently asked questions What is Gryphon? It covers the basic information needed to begin using Gryphon, whether you want to translate command line programs, translate a new iOS app to Android, or add Gryphon to an existing app. $ docker run -it -rm -privileged -v /absolute/path/to/current/directory/:/app/Gryphon gryphonĬheck out the Tutorial to get started. Use Homebrew to install Gryphon and its dependencies automatically: You can also check out the currently supported translations for the Swift standard library here. If that's the case, feel free to report a new issue on GitHub. However, users often find new bugs to be fixed. This means the main systems and ideas have already been implemented - for instance, it's been translating a complete version of its own codebase for a while now. Use special comments and templates to customize your Kotlin translation, and use any platform-specific features you want - even in translated source files. Translate your iOS code to Android, compile the Android app, and see Kotlin's errors and warnings in the Swift lines that originated them - all without leaving Xcode. Translated Kotlin files work the same as the Swift files they came from. Stop using Gryphon whenever you want - you'll still be able to read and understand your Kotlin code, even the computer-generated parts. It was created to enable mobile app developers to share parts of an iOS app's codebase with Android. Gryphon is a program that translates Swift code into Kotlin code. On macOS and Linux these classesĪre compiled into a jar file ~/swiftjava.jar using the genjar.sh script for this to work.Gryphon is looking for new maintainers! If you're interested in helping out or just want to check out our progress, head over to the GitHub forum post. This approach is also taken for processing events and all interfaces with namesĮnding in "Listener", "Manager" or "Handler" also have "Base" classes generatedįor subclassing along with Java Proxy classes. Provide a Swift implementation of the "run()" method callable from Java. Side this is surfaced as the "RunnableBase" class which can be subclassed to Implementation of the "run()" method that calls through to Swift. Proxy class which has a pointer to the associated Swift object and a "native" Where Java code can call through to Swift code. With a ProtocolForward class an instance of which conforms to the protocol andĬan be used to message Java instances conforming to the interface/protocol.įor the Runnable interface used in threading the converse needs to be possible / public () private static var toString_MethodID_7: jmethodID ? open func toString() -> String ! Forward, Runnable, Listener, Adapter, subclass responsibility and Base classes.įor every Java interface the code generator generates a Swift Protocol along ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |