Google is thinking to add Swift support on Android ? Don’t forget Kotlin !
Since Swift has been open sourced, it has received a lot of interests from individual developers or giant brands like Google, Facebook or Uber. Now, some sources reported that Google is considering making Swift a « first class » language for Android. Currently, Google’s Android operating system supports Java as its « first class » language but because of litigations with Oracle, Google could think to an alternative solution.
Obviously, Swift is not meant to replace Java for the moment but Google could consider that Swift has more advantages than Java for the future of Android. Indeed, Swift is open source, which means Google could adopt it for Android without any changes in its own open source mobile structure. A big advantage from Java.
Created by Apple to replace Objective C, Swift has known a quick success thanks to its easy-to-write syntax. Beside, IBM has given it a major support. To enable support for Swift on Android, Google would need a runtime for Swift but Google would also have to make its entire standard library Swift-ready with a support for the language in APIs and SDKs. Even harder, some low-level Android APIs written in C++ should be re-written. All of these efforts would permit to avoid to use Android NDK to support Swift on Android which is a prerequisite for a large adoption by developers.
Like you can see, there is still a long way before a support for Swift in Android. But Google needs an alternative way next to Java. So, which would be an easier solution for Google ?
Answer is Kotlin ! The pragmatic language for Android and JVM has just reached version 1.0 and is also considered by Google to become a « first class » language for Android. Like Swift, Kotlin is object oriented with a focus on safety but unlike Swift, Kotlin works already with Android Studio, the Google’s IDE for Android development. So, Kotlin could be the best solution for Google. But because there is a but, Kotlin is considered a bit too slow when compiling by Google. However, Kotlin is considered as a language that works everywhere Java works and with seamless support pro projects mixing it and Java.
Thus, Google needs to analyze the pros and cons. May be better performance a compilation with hard internal work for Swift, or less work but some potential issues with performances with Kotlin. Note that you can already use Kotlin in your Android projects and start to enjoy its concision to gain productivity in your Android development.