Swift for Android

“The journey of a thousand miles begins with one step.” — Lao Tzu

So, the news last week was that swift ported to android and there is even a hello world tutorial now over at Swift repo. Head over to Github for Getting started with Swift on Android

Albeit with a caveat. Not so fast it says…

Does this mean I can write Android applications in Swift?

No. Although the Swift compiler is capable of compiling Swift code that runs on an Android device, it takes a lot more than just the Swift stdlib to write an app. You’d need some sort of framework to build a user interface for your application, which the Swift stdlib does not provide.

Alternatively, one could theoretically call into Java interfaces from Swift, but unlike as with Objective-C, the Swift compiler does nothing to facilitate Swift-to-Java bridging.

Need Framework to build UI

So, we need a bridge to Java, we need all the core libs. However, over at Swift there are already a few platform independent efforts like foundation framework that provides

  • Provide a small set of basic utility classes.
  • Make software development easier by introducing consistent conventions.
  • Support internationalization and localization, to make software accessible to users around the world.
  • Provide a level of OS independence, to enhance portability.

A libdispatch framework a.k.a Grand Central Dispatch (GCD) in progress that provides provides comprehensive support for concurrent code execution on multicore hardware.

Intertubes was also abuzz with the news that Google is seriously considering providing first class support for Swift on Android. As I noted in my previous post this might actually solve the portability problem for mobile platforms. Facebook’s efforts with ReactNative and its motto of “learn once, write anywhere.” could actually become a reality with Swift for Android. Also put an end to efforts trying to port web technologies to mobile platform. What is more Swift could actually go full-stack from back to front.

Watch this space, every minute, every day.

Like what you read? Give Ravi Shanker a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.