Apple at the WWDC 2015, had promised of making its popular SWIFT programming language available under an Open-Source license by the end of 2015. One of the main take away from such an announcement according to Apple Senior VP of Software Engineering Craig Federighi was to “make Swift available everywhere and used by everyone”.
As we move into 2016, we find developers across platforms having a gala time getting the best of the lightning fast Swift language (initially intended for iOS and OS X applications) that has made development faster and easier.
How Android Developers can Harness Apple’s Swift
With Swift becoming available for Android development as part of Apple’s decision to open-source the programming language, it has opened up opportunities for developers to run Swift code on an Android device. So how does it work?
Related: Mobile App Development Trends 2016
Being a compiler infrastructure that leverages the very interesting concept of a retargetable compiler, LLVM instead of generating machine code targeting a specific architecture generates assembly code for an imaginary machine. It then converts that intermediary representation to actual code for the architecture as per requirement.
The Process: How to Build Android App with Swift
On requesting the Swift compiler to generate LLVM-IR (intermediate representation); LLVM also generates the ARM ELF file format used from the IR. Thereafter, the Android NDK that allows for use of native-code languages on Android generates a binary linking against the generated object file. So the file that you get is packaged as an Android app.
The most evitable question hereafter is what issues developers will face. Well, the biggest issue is going to be the absence of SwiftCore library, for Apple as of now won’t be shipping an Android version. But experts opine that there can be an alternate way out, for not all Swift code require the SwiftCore library. Thereby, as long as you use the subset of Swift that do not hit SwiftCore it’s pretty much sorted. Another limitation developers might face is the absence of Swift UI framework on Android yet.
The road ahead…..
With Swift being made available via open source, development tool companies will be able to write IDEs in which developers can write in Swift and directly compile to Android. This makes it all the more important for Apple’s Swift open-sourcing effort to include SwiftCore, and then getting a SwiftCore library on Android – as a matter of rebuilding it.
Visit our Swift app development page for more info. on latest offerings.
Being a programming language very similar to Java and C#, it is not very difficult to get Swift to compile toward Android. The only difference is that Swift is newer and has some newer concepts, even though Java keeps getting upgraded.
Click here to Get a free quote now!