Skip to main content

Swift code will run on Google's Fuchsia OS

Swift code will run on Google's Fuchsia OS

/

Still doesn’t help explain why Fuchsia exists

Share this story

Gallery Photo: Apple Swift photos

A few days ago, there was a flash-in-the-pan controversy over Google "forking" Apple's open-source programming language Swift. After a few minutes of speculation over whether Google was going to make its own special flavor of the language for its own purposes, Swift's creator Chris Lattner (who now works at Google) helpfully clarified the situation:

Google just wanted its own working copy of the code so it could make changes and then contribute them "upstream" to the official Swift repository. No funny business.

What's more interesting is that one of those changes has already landed as a pull request to the main Swift repo: Fuchsia support (via Android Police). Google developer Zac Bowling, who helped port Objective-C to Android a few years ago, even shared the news as a reply to Lattner’s tweet:

You can also stalk Google’s code review system to check out an example Swift app for Fuchsia, which prints out some emoji and the Chinese characters for “hello world.” Once Google’s suggested changes to Swift are merged, that code should run.

Fuchsia is Google's not-at-all-but-kind-of-secret operating system that's being developed in the open, but with almost zero official messaging about what it's for, or what it's built to replace. (Android? Chrome OS? Both? Neither?) The operating system's core is written in mostly C and C++, with Dart for the default "Flutter" UI, but other languages like Go, Rust, Python, and now Swift have also found a home in the project.

Of course, just because you'll be able to compile Swift to run on Fuchsia doesn't mean you'll be able to instantly port any iOS app to Google's new OS when or if it ships. While Apple has open sourced the Swift language itself, much of the iOS platform (like the UI stuff, for instance) is closed source, so code that relies on those closed Apple libraries won't be portable.

One possible future in a world where Fuchsia is an important and relevant platform for apps is that you write the "core logic" of your app in your language of choice — Swift, Go, Rust, JavaScript, etc. — and then you build a custom UI for each platform — Android, iOS, Fuchsia, Linux, Windows, the web — using the appropriate tools for each.

The alternative path could be the continued adoption of tools like Google's Flutter, or Facebook's React Native, which allow you to target multiple platforms with a single language like Dart (Google), or JavaScript (Facebook). There's even a cross-platform framework called SCADE that allows you to build iOS and Android apps in Swift.

It's a fun time to be a language nerd, and maybe someday it will even be a fun time to be an app developer.