When Swift was going open source, representatives for three major brands — Google, Facebook and Uber — were in London discussing the new language. Sources said that Google is considering making Swift a “first class” language for Android, while Facebook and Uber are also considering Swift. Google’s Android operating system now 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. Swift is 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. 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. 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.
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.
When could a move to Swift happen?
We think that this won’t happen anytime soon, mainly because of 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 (GitHubtells 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++. 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 Perfectprove 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.