In order to make the iPhone that much leaner and easier to program for, Apple wound up creating the Swift programming language to replace the deep-level language, Objective C, that had been used since the inception of iOS. Objective C, used at the core of tons of Linux-based systems. A variant of Objective C, C++, actually lies at the core of Android, underneath Java. Near the end of last year, Apple made Swift open-source. This move attracted the attention of Facebook, Uber and Google. Google, in particular, took a keen interest in the newly open-source language. Details suggest that Google was reportedly giving serious consideration to replacing Android’s current backend with Swift.
While Swift was made to replace a C-based language, it is certainly not usable as an in-place swap out, especially with a system like Android whose core functions depend on a layer over a C variant, being Java in this case. In order to pull this off, all of the core Android code that runs on the C++ backend would have to be ported to Swift, as well as all of the Java functions, bringing the setup from a shell and core ordeal to a more cohesive and holistic code base. This would be a massive undertaking, but amateur developers have already proven, in theory at least, that it’s possible; One developer, Romain Goyet, managed to do some monkeying around with Swift and Android, though it was far from a comprehensive system replacement.
In essence, Google would have to rip out Android’s guts and rewrite them for Swift, as it’s not cross-compatible with Java or C++. An easy way out would be, of course, to program a bridge, but that could introduce bugs and performance problems. To add insult to injury, making a simple bridge would still leave Google using Java in some form and thus on the hook to Oracle, who is already after them in court for damages and, in essence, royalties, for their extensive use of Java in Android. As an aside, a second language, Kotlin, is in consideration – it is also object-based and open-source, as well as compatible enough with Java to serve as an in-place replacement. At the moment, however, Google is saying that it’s too slow to use for such purposes.