About the time Swift was going open source, representatives for three major brands — Google, Facebook and Uber — were at a meeting in London discussing the new language. Sources tell The Next Web that Google is considering making Swift a “first class” language for Android, while Facebook and Uber are also looking to make Swift more central to their operations.
Google’s Android operating system currently supports Java as its first-class language, and sources say Swift is not meant to replace Java, at least initially. While the ongoing litigation with Oracle is likely cause for concern, sources say Google considers Swift to have a broader “upside” than Java.
Ever been to a tech festival?
TNW Conference won best European Event 2016 for our festival vibe. See what's in store for 2017.
Swift is also open source, which means Google could adopt it for Android without changing its own open source mobile structure.
Could Google do it?
Born at Apple as a replacement to Objective C, Swift quickly found favor with developers as an easy-to-write language that shed much of the verbosity and clumsy parameters other languages have. It was introduced at WWDC 2014, and has major support from IBM as well as a variety of major apps like Lyft, Pixelmator and Vimeo that have all rebuilt iOS apps with Swift.
Swift can’t be copy-pasted for any platform, though. Specifically, Android would need a runtime for Swift — and that’s just for starters.
Google would also have to make its entire standard library Swift-ready, and support the language in APIs and SDKs. Some low-level Android APIs are C++, which Swift can not currently bridge to. Those would have to be re-written.
Swift would also not be useful in bridging higher level APIs in Java; they’d have to be re-written as well.
Using Swift for Android is not impossible, though. Late last year, developer Romain Goyet toyed with Swift for Android — and had some success. While that project was completed well ahead of Swift being open source, it nonetheless proved that it can be done.
That project used the Android NDK, which allows other languages to be loosely implemented into Android. With an open source Swift and support from Google, Android apps wouldn’t require that toolkit.
All told, Google would have to effectively recreate its efforts with Java — for Swift. If the company is motivated enough, it’s very possible to do so without compromising on its open source values or ruffling any developer feathers along the way.
Just reaching its potential, sources also claim Kotlin is being discussed as a first class language for Android.
Like Swift, Kotlin is object oriented with a focus on safety. Unlike Swift, Kotlin works with Android Studio, Google’s IDE for Android development.
Unfortunately, sources tell The Next Web that Google’s current mindset is that Kotlin is a bit too slow when compiling.
But, Kotlin is billed as a language that “works everywhere Java works,” and has “seamless” support for projects that mix it and Java.
It would be much less work on Google’s end to get Kotlin up and running for Android, but could be a tedious transition for developers.
Facebook and Uber
Facebook’s interest in Swift appears to be completely founded in technological advancement.
A benefit of Swift is that it can serve as both a forward-facing language as well as a server-side one. For a product like Facebook, that’s beneficial; apps and servers can speak to one another seamlessly, and it potentially gives the company a wider scope to write APIs for services.
And work may have already begun. A Github pull request in the Swift repository named ‘Port to Android’ was made by a Facebook employee. It’s not clear if his work was official Facebook business or not, though we have confirmed Facebook is already working with Swift internally — it’s just not known how thoroughly.
Uber’s road to Swift is probably a bit cleaner than either Google or Facebook. Though there are many moving parts to Uber’s service (app, server and API), it can use Lyft’s transition to Swift as an example.
When Lyft migrated its iOS app to Swift, it was a ground-up remodel that took a lot of time and effort — but resulted in an app that’s lighter, leaner and easier to maintain. It’s not known how much (if any) of Lyft’s back-end uses Swift, but the company has been highly complimentary of Swift in its existing application.
When could a move to Swift happen?
The short answer: not anytime soon. The reason? Android.
But Swift is quickly finding its way. Several studies suggest it’s one of the fastest growing languages around, and has blown up since going open source (GitHub tells The Next Web the language is currently its 11th most popular). Demand for developers who know Swift is also exploding, which could be all the indication these three companies need to at least explore using Swift more thoroughly.
Google’s onboarding for Swift would be long; it essentially has to rewrite every Android service, app and API. Google would also have to spearhead Swift support for Android — which is still only being poked and prodded at by clever developers in the Swift community.
In a way, Google has already begun moving away from bits of Oracle-flavored Java. It’s now using the Open JDK for Android rather than the proprietary Java API, and may be considering a post-Java life altogether. Talks in London were said to be exploratory; Google is not yet pushing to move on from Java. While it would be a big undertaking, Swift is meant for speed and safety, and Swift’s roadmap suggests it won’t be quite as difficult to use it for other platforms in the future, specifically when it comes to C++.
Though Kotlin is an alternative, it’s a very nascent language without the eager community Swift has.
Facebook and Uber face similarly daunting tasks when it comes to using Swift throughout, but can –and should — wait for Google to shoulder the load with Android. If the use of Swift is going to be as deep as our sources indicate (that is, all companies want to be using it for server side and forward-facing use cases), Android support is integral.
Moving to Swift for any of the companies also makes little sense unless it’s a thorough re-do, but it’s probably not quite as hard as it sounds. Services like Perfect prove that server-side Swift is ready, and it’s worth considering that Facebook’s engineers (perhaps from the Parse team) may already be working on this.
IBM is also working to make Swift ready for server-side functions.
But don’t expect Google, Facebook or Uber to announce Swift-y plans anytime soon. Facebook and Google both have developer conferences on the horizon, and there’s no indication that Swift will play a major part at either.
We reached out to all three companies for comment on the information our sources brought forward. All three declined to comment. Google specifically pointed to its ongoing litigation with Oracle as reason not to participate in this article. Make of that what you will.