Running Swift code on Android
The biggest issue here is going to be a missing SwiftCore library. Right now Apple is shipping one for iOS, OS X and Watch OS. But that's it - and obviously they don't ship an Android version.
However, not all Swift code requires the SwiftCore library, just like not all C++ code requires the STL. So as long as we use the subset of Swift that doesn't hit SwiftCore, we should be ok.
Romain Goyet
How to Use Apple Swift to Make an Android App
Our best course of action to get something working quickly was to take Swift code and compile it into Java source code — and then take it into the Android development environment to finish building it into an installable app. So we started in Xcode, where we wrote the Swift code. Then we tested it, including running it on an iPhone or in the iPhone Simulator, and ran a custom compiler that parsed the Swift code and output Java source code (adjusting any necessary syntax, and substituting appropriate Android calls for any iOS native ones). Then we moved it into Android Studio to finish the build process and produced the Android APK.
ArcTouch
Is it possible to make Android apps with Swift?
The big questions are:
1) Should Swift compiles to Dalvik? This probably require making a LLVM backend to Dalvik. This will be the opposite of a RoboVM approach, and there are been some tentatives to do LLVM to Bytecode, so, it might work.
2) Should Swift compiles to NDK output (Android native). This would probably be a more conventional approach for the LLVM architecture. The trick is that the NDK get a very raw API for building UI, so the developers will have to reimplement the UI component set.
3) Should Swift be just wrapper to the "Dalvik" UI Component set, and Swift developers will have to learn the Android way of building UI, but with Swift. This will work good with #1.
4) Should Swift try to mimick the iOS MVC model and UI component as much as possible. This will probably be better with #2.
My sense is that the lowest hanging fruit (which still require quite a bit of work) is Swift compile to Dalvik bytecode (#1) with full Dalvik component/library access and be a wrapper on Android UI component and constructs (#2). Now, the question is will this be worth all of the effort.
Quora
Silver - Swift, now also on .NET, Java and Android.
Silver is a free implementation of Apple's Swift programming language.
With Silver, you can use Swift to write code directly against the .NET, Java, Android and Cocoa APIs. And you can also share a lot of non-UI code between platforms.
Built on over ten years of solid compiler knowledge and technology, Silver is a truly native Swift compiler for the .NET CLR, the Java/Android JVM and the Cocoa runtime.
Silver supports three platforms, but is decidedly not cross-platform, focusing on letting you leverage the Swift language natively for each individual platform, rather than encouraging mediocre cross-platform apps. With Silver, you can share your language and tool expertise, and you can share a lot of back-end business logic code – but you will use it to write apps targeted at each platform individually. Why? Because that's how great apps are made.
Elements
The biggest issue here is going to be a missing SwiftCore library. Right now Apple is shipping one for iOS, OS X and Watch OS. But that's it - and obviously they don't ship an Android version.
However, not all Swift code requires the SwiftCore library, just like not all C++ code requires the STL. So as long as we use the subset of Swift that doesn't hit SwiftCore, we should be ok.
Romain Goyet
How to Use Apple Swift to Make an Android App
Our best course of action to get something working quickly was to take Swift code and compile it into Java source code — and then take it into the Android development environment to finish building it into an installable app. So we started in Xcode, where we wrote the Swift code. Then we tested it, including running it on an iPhone or in the iPhone Simulator, and ran a custom compiler that parsed the Swift code and output Java source code (adjusting any necessary syntax, and substituting appropriate Android calls for any iOS native ones). Then we moved it into Android Studio to finish the build process and produced the Android APK.
ArcTouch
Is it possible to make Android apps with Swift?
The big questions are:
1) Should Swift compiles to Dalvik? This probably require making a LLVM backend to Dalvik. This will be the opposite of a RoboVM approach, and there are been some tentatives to do LLVM to Bytecode, so, it might work.
2) Should Swift compiles to NDK output (Android native). This would probably be a more conventional approach for the LLVM architecture. The trick is that the NDK get a very raw API for building UI, so the developers will have to reimplement the UI component set.
3) Should Swift be just wrapper to the "Dalvik" UI Component set, and Swift developers will have to learn the Android way of building UI, but with Swift. This will work good with #1.
4) Should Swift try to mimick the iOS MVC model and UI component as much as possible. This will probably be better with #2.
My sense is that the lowest hanging fruit (which still require quite a bit of work) is Swift compile to Dalvik bytecode (#1) with full Dalvik component/library access and be a wrapper on Android UI component and constructs (#2). Now, the question is will this be worth all of the effort.
Quora
Silver - Swift, now also on .NET, Java and Android.
Silver is a free implementation of Apple's Swift programming language.
With Silver, you can use Swift to write code directly against the .NET, Java, Android and Cocoa APIs. And you can also share a lot of non-UI code between platforms.
Built on over ten years of solid compiler knowledge and technology, Silver is a truly native Swift compiler for the .NET CLR, the Java/Android JVM and the Cocoa runtime.
Silver supports three platforms, but is decidedly not cross-platform, focusing on letting you leverage the Swift language natively for each individual platform, rather than encouraging mediocre cross-platform apps. With Silver, you can share your language and tool expertise, and you can share a lot of back-end business logic code – but you will use it to write apps targeted at each platform individually. Why? Because that's how great apps are made.
Elements
Comments
Post a Comment