It wasn’t that long ago that Apple surprised iOS developers with Swift. In the short time since then, it has enjoyed a rapid pace of adoption among the development community. In fact, in a survey conducted by Stack Overflow, Swift was named the most loved programming language.
On December 3, Apple stayed true to its word and officially made Swift entirely open source. Given Swift’s popularity, it’s certainly exciting to think about the implications of the move. What does the future hold for Swift and what can we do as developers to help shape its evolution?
Apple and Open Source
As someone who enjoys doing iOS development as a living, I’ve always been somewhat jealous of the open source community. While it’s true that GitHub is thriving with open source iOS projects, in both Swift and Objective-C, historically Apple hasn’t let the iOS community contribute much to its tools, frameworks, IDEs, or languages in any official capacity aside from ResearchKit.
Now, with Swift, we’ve been given an invitation to help foster the future of the language. This is a new frontier for the iOS community, and I believe it will also extend a bit of goodwill from Apple to the developers who work on their platforms daily. What’s more, Swift’s future can now extend far beyond iOS—something we will discuss later on.
One immediate benefit of this move, for me at least, is that we can now enjoy an intimate look at Apple’s development practices and processes. In fact, Swift’s repository on GitHub has all the commits for anyone to view, dating all the way back to the initial commit on July 17, 2010.
Impact of Open Source
If you haven’t thought about the impact of Apple’s move to open source Swift, I think it’s important to take a step back and take a look at it. History shows that open sourcing a software project has many benefits.
In general, an open source project that gains traction in the community quickly matures, becoming more stable over time. If the community is actively involved, new features can be implemented quickly.
Aside from faster iterations, the community helps the software mature in a way that’s beneficial to those who use it most. Open sourcing a project also often results in more collaboration within the community, which is win for everyone involved.
The list goes on and on. In a world that’s dependent on technology and the tools behind it, I would suggest to you that it’s never been more important, and relevant, to open source software. The power of a community working on software can be a rewarding, and more importantly, productive initiative.
In fact, we’ve even seen Apple partner up with other prominent technology companies to help bring Swift to the next level. IBM seems to have a lot of interest in implementing Swift as a server side language, and you can already enjoy an incredible project from their efforts in their online swift sandbox.
Swift Will Evolve Quickly
In the end, open sourcing Swift means it’s going to change at a fast pace. Typically, fast change could mean headaches for engineers. We’ve even seen this in Swift to a certain degree. Swift 2 introduced many changes that made Swift 1 code obsolete and uncompilable.
The key difference now is that Apple and and the community are the ones driving the change. With an open door look at what’s happening to Swift, developers can be better prepared for upcoming changes. Iterations in software shouldn’t be an exercise in frustration, it should be a beneficial and welcomed practice. Open source software excels in that regard.
To demonstrate this, consider these metrics that the Swift repository has experienced in the short time it’s been live:
- 10,000 commits occurred in the first 24 hours
- over 24,000 commits to date
- around ~400 pull request have been merged to Swift’s repositories
At the time of writing, Swift is also steadily trending at the #1 spot on GitHub. That’s quite an accomplishment in a short amount of time, and it clearly shows the development community at large is ready and willing to contribute.
As a developer, it’s energizing to see the language adapting at an “open source” pace already. For example, popular iOS developer and author Erica Sadun has already made a convincing case to remove C-Style looping in Swift. Additionally,
++ operators are likely on their way out, too.
Considering those facts, we are already seeing Swift benefit from being open source. Not only is it maturing, being made compatible with other platforms aside from iOS, but developers can also see the changes happening publicly. Adapting codebases for Swift 3 should really be no problem, because we no longer need to wait for the next WWDC to be made aware of advances to the language.
Where to Start
Considering the open source impact, you may be wondering how to get involved yourself. Open source software can initially be a bit intimidating if you haven’t been involved with it before. Here, I’d like to point out some ways you can get a better feel for open source software, and Swift in particular.
A good place to start getting involved with open source Swift are the discussions themselves. Unsurprisingly, a lot of these discussions originate on Twitter. Some prominent bug fixes mentioned over Twitter have even been fixed before Swift was open sourced.
Developers can easily voice their ideas for Swift using Twitter’s low barrier to entry. What’s more, you don’t have to go through the process of contributing code quite yet. It’s a low stress way to begin contributing to Swift.
It’s also fun and educational interacting with Swift’s developers. They were quite active on Twitter leading up to the open source move, and even more so after it. That said, here are some Apple engineers that are immediately involved with Swift.
Chris Lattner @clattner_llvm
Chris is responsible for bringing us Swift and he was also the original author of the LLVM compiler infrastructure. Naturally, he is always engaged with the Swift community. In fact, he’s even been accepting pull requests at 10:00 pm on a Saturday. To say he is actively involved with the project would be an understatement.
Jordan Rose @UINT_MIN
Jordan is another top-notch engineer from Apple who primarily focuses on Swift. Like Chris, Jordan is also a great resource to raise Swift questions or concerns.
Joe Groff @jckarter
Joe is also a talented engineer working on Swift. He’s answered several questions about Swift and is always happy to engage with the community.
Swift’s open source initiative is run through the popular GitHub platform. If you aren’t familiar with GitHub, or Git in general, contributing to Swift can be quite an intimidating prospect. If that’s the case for you, I’d highly recommend getting familiar with these tools first, and this is a good place to start.
To get started, you’ll need to set up a local environment. Swift’s GitHub README is an excellent guide to follow, so I won’t repeat those steps here. Basically, after only a few commands from the command line and interactions with the repository, you’ll be up and running.
When contributing to open source software, or any software in general, it’s good to start with a small, manageable goal. In fact, Chris Lattner encourages it.
Try to find some pieces of the codebase and get familiar with them. From there, you’ll be better suited to see what could be improved. Personally, the first step I would take is to read the Swift Contributing Guide.
Swift Open Source Projects
Some exciting (and surprising) news that came from Swift’s open source announcement were some projects that are in development with the language. A few of them were expected, such as the compiler and standard library, and some were brand new initiatives.
Each of the four major projects are developed openly, so contributions are welcome. Let’s take a brief look at each of them now.
Compiler and Standard Library
Taken from swift.org, Swift’s compiler “is principally responsible for translating Swift source code into efficient, executable machine code.” Even if you don’t have a deep understanding of compilers or how they work, it’s fascinating to browse through its code if only for educational purposes.
The second component of this project, the standard library, is likely something most developers will be familiar with. It houses everything from the most fundamental data types, such as
Double types, to advanced collection types, such as
If you are an avid Swift developer, you now have the power to help mold how these types work. Or, if you wanted a specialized feature set specific to your needs, you could even fork the repository and customize Swift’s types as you see fit.
Swift Package Manager
Though it’s in the very early stages of development, this is the project that I find most interesting. In fact, it currently doesn’t support iOS, tVOS, or watchOS. While support for those platforms will certainly come, as it matures, it could be potentially used to distribute Swift code far beyond just iOS or OS X.
The Swift Core Library project is closely related to the standard library, except that it provides higher order functionality. Tools included in this project are typically platform agnostic concepts.
For example, the core library project houses functionality for JSON parsing, unit testing, and interacting with the file system. These are tools that will be depended on no matter the platform or project at hand.
To put this project in more relatable terms for iOS and OS X developers, libdispatch is housed here. You are likely familiar with that since it’s where Grand Central Dispatch comes from. That said, it makes sense that it’s included in the Core Libraries since executing concurrent code is not a task specific to just iOS or OS X.
REPL and Debugger
Lastly, the REPL and Debugger project is probably a bit self explanatory. This project is responsible for the implementation of Swift’s full debugging suite. The LLDB debugger is something developers have been using for quite some time now, because it’s included in Xcode.
The REPL and Debugger are highly coupled, though, which makes sense as they provide similar value in a lot of ways. REPL stands for “Read Eval Print Loop” and it’s great to use for lightweight Swift code. If you open terminal and type “Swift”, you’ll start running the Swift REPL locally.
As you can see, there is certainly no shortage of projects or components of Swift to contribute to. Though, cliche as it sounds, this is only the beginning and several new projects will emerge over time.
To wrap up, I’d like to leave you with some resources that you can use to further your knowledge of Swift’s open source landscape.
This is the official destination for all of Swift’s development. It includes guides for getting started, summaries of all the ongoing projects, and more. This should be your fist stop if you want to get involved.
While this one has been around for awhile, if you haven’t visited it before you should. It contains a lot of useful information about Swift and its architecture written by Chris Lattner. Though it remains to be seen if it will be maintained in lieu of swift.org, it’s still a valuable resource.
I’ve mentioned this a few times now, but this is where all of Swift’s development takes place. If you wish to browse code, fork repositories, or submit pull requests, this is where it happens.
This is an excellent mailing list to subscribe to if you are primarily interested in seeing how Swift will evolve and the direction the language is taking. In addition, there are several other mailing lists to consider subscribing to, which all discuss various aspects of Swift’s development. You can see them all here.
Like any other software, Swift has bugs. This is the central location the Swift team uses to track bugs and follow them until they are resolved. Aside from bugs, improvements can also be suggested here.
Swift is going to play a large role in iOS development going forward. I think developers have known that since it was announced at WWDC 14. What’s exciting is that it will now manifest itself outside of just Apple’s platforms. Imagine using Swift as a server side language when developing an API?
Perhaps more important than Swift’s growth is the fact that the community will be driving the change. Open sourcing Swift will open a lot of doors for both you and the language. Now is the time to get involved, so start reading the contributing guidelines and I look forward to seeing your next commit in the Swift repository.