At this year’s WWDC, Apple announced that they would be open sourcing Swift. Now that the code is available, we can finally see what they’ve been working on.
When Apple made the announcement, it wasn’t immediately clear what would be included. In the most pessimistic scenario, we would get only the Swift standard library. However, Apple has gone above and beyond by also including Core Foundation, Grand Central Dispatch, a Swift Package Manager, and a few repositories dedicated to collecting feedback and clarifying the future of Swift.
In short, everything that a developer would need to use Swift is now open source. As with any open source project, it’s worth noting Swift’s license. Apple has decided on Apache 2.0, with a special modification:
As an exception, if you use this Software to compile your source code and portions of this Software are embedded into the binary product as a result, you may redistribute such product without providing attribution as would otherwise be required by Sections 4(a), 4(b) and 4(d) of the License.
This change to the license prevents the typical ‘copyleft’ restrictions, allowing developers to use Swift without having to also open source their own projects.
Transparency is one of the biggest benefits of open source. In the past, Apple has used opensource.apple.com for releasing code. Software updates would be larger and less frequent. The switch to GitHub allows us to see progress as it happens, tightening the feedback loop between Apple engineers and the open source community.
We’re also able to inspect the entire history of the project. We can see Swift’s humble beginning as an empty main function. We can also use tools like gource to visualize how the project has evolved up until this point:
Looking toward the future, we should be able to see features of Swift as they’re being developed, which will allow developers more time to anticipate changes.
Apple is serious about getting Swift up and running on Linux as well as OS X. They’ve already added support for Ubuntu.
This is great news for anyone who is writing an app that connects to a Linux server. Linux compatibility will allow developers to save lots of time and effort by sharing code between the front end and backend.
Lots of developers love Cocoapods. Apple is clearly responding to that popularity with The Swift Package Manager. The manager is still in development, so the features are not completely nailed down. However, if this sounds like something that would be useful to your project, check out some of the example packages.
Apple has always carefully chosen long-term investments in specific technologies. Steve Jobs once said, “We try to pick [technologies] that are in their spring … Sometimes you have to pick the things that look like the right horses to ride going forward.”
Former Apple Senior VP Scott Forstall once described the thought process behind the creation of OS X, saying, “We wanted an operating system that could last for another 20 years. The operating system that Apple had at the time didn’t have those legs.” This effort was a success, as OS X came out about 15 years ago and is still going strong.
I can hear a similar thought process behind Swift. This year Craig Federighi, Apple’s Senior VP of Software Engineering, said, “For 20 years to come, we think Swift should be everywhere and used by everyone.”
Apple clearly thinks of Swift as a critical part of its future, and open sourcing Swift is Apple’s way of saying that this language has legs.