At WWDC in June, Apple announced it would be open-sourcing its Swift programming languageby the end of the year. Well, it’s the first week of December and Apple kept is promise: Swift is now open source.
Apple introduced the Swift programming language at WWDC in 2014, touting it as the best language going forward for building apps for Apple platforms — which include iOS, OS X, tVOS and watchOS. In some ways, Swift can be seen as a successor to Objective-C.
At WWDC, Apple senior vice president of software engineering Craig Federighi said one of the reasons the company felt it was important to open-source Swift was because of its thought that “the next big programming language” would live on for years to come.
The lack of an open-source license hasn’t slowed Swift’s adoption — StackOverflow surveysshow interest in the language continues to be high — but it has limited it to the Apple community.
Open-sourcing Swift has the potential of making the language take off on other platforms, too.
Apple has set up Swift.org as the main hub for the Swift open-source community. This website will contain the mailing lists, reporting tools, tutorials, documentation, blogs and binary downloads for OS X and Linux.
But what’s an open-source project without a Github profile? Nothing, so Apple is putting its public source-code repositories for Swift on Github at http://github.com/apple. The company says it willbe accepting pull requests — so it really does seem like this is a full open-source effort and not something half-assed.
Apple is also launching a new Swift Package Manager. This package manager is in its early stages but will be open from the beginning. The early stages of the package manager are on Github, and Apple says it will work with the community to help define how it will work.
In addition to making the compiler, debugger and REPL open-source, Apple is also making a bunch of core libraries used in Swift open-source as well. This includes Foundation, libispatch and XCTest.
A permissive license
Apple is licensing Swift under the Apache 2.0 license with a run-time attribution exception. The Apache license is one of the most common open-source licenses on the planet.
It’s not GPL (which historically, Apple would reject anyway, for complicated reasons), but it’s ratified by the Open Source Initiative and fits the goals of the existing communities.
A key part of this license is the run-time attribution exception, which basically opens the door for other IDEs (integrated development environments) to add Swift support to their tools.
This is huge because as of right now, the only IDE that supports Swift natively is Xcode. Xcode is a great development tool, but it’s Mac-only.
Targeting Linux first
Although the nature of the open-source license and the community resources mean Swift can come to other platforms, the initial platform Apple is focusing on when opening Swift up is Linux.
On the surface, it may seem odd to eschew Windows for an operating system with much lower market share, but in the developer world, it makes complete sense.
Linux dominates the server market. Right now, developers can write their client code in Swift but if they want to write code that executes in the cloud, they need to use something else. Having Linux support opens the door to making Swift a more robust language for more than just client apps.
This isn’t to say Swift can’t still find its way to Windows — but Apple hasn’t indicated Windows is its focus, at least not right now.
Running like a community
The real test Apple will face with open-sourcing Swift is integrating into the existing Swift developer community as well as the broader open-source communities.
Apple says its governance model with Swift will be similar to the way the compiler LLVM is governed (this makes sense as the creator of Swift is also the original author of LLVM) wherein there will be code owners that oversee certain aspects of the project.
Right now, those code owners are Apple employees, but that will change over time and the plan is to create new code owners based on merit and contribution — rather than employer — as is currently the same with LLVM.
Still, it will be important for Apple to be open with the broader non-Apple community — not to mention the cadre of Swift developers — as it builds out the language.
When large companies steer open-source projects, there can often be conflicts between the whims of the corporate overseer and the needs of the greater community.
We’ve seen this play out before at Apple with WebKit. The rendering engine that powers most of the web is steered by Apple but was forked by Google in 2013 because of disagreements over its future.
The good news for Swift is that because it shares so many similar players as the team behind LLVM, the understanding of open-source — especially at a language level — appears to be better.
The bottom line is that Swift being open-source is good for Apple, good for Swift developers and good for open-source software in general.
If Apple really does want Swift to be the programming language of the next 20 years, this is an important step in making that happen.