Apple's Swift takes first steps toward Android app development

From InfoWorld: Apple’s Swift language, initially intended for iOS and OS X applications, will become available for Android development as part of Apple's decision to open-source Swift. But developers can start using Swift now for Android, says developer Romain Goyet, author of a recent blog post on the concept.

Swift uses the LLVM compiler, notes Goyet, who gained notoriety by reverse-engineering Apple’s Siri. "The current Swift compiler plugs into LLVM to generate binaries," he writes. "It is also worth noting that both LLVM and Swift were designed by Chris Lattner."

Instead of generating code for a specific architecture, LLVM generates assembly code for an imaginary machine; the intermediate representation is then converted to actual code for the targeted architecture.

Goyet describes a process in which the Swift compiler is asked to generate LLVM-IR (intermediate representation); LLVM also generates the ARM ELF file format used from the intermediate representation. Then the Android NDK, which allows for use of native-code languages on Android, generates a binary linking against the generated object file. The file is packaged as an Android app.

View: Article @ Source Site