News

Open Source Community Helps Shape New Swift 3.0 Developer Preview

Apple announced Developer Preview 1 of Swift 3.0, the first major release with significant community contributions since the official programming language for building iOS mobile apps went open source last December.

With a huge list of changes, Swift 3.0 isn't totally backwards-compatible with the previous version 2.1.1, as it wrestles with handling APIs from Objective-C, the previous "official" language for Apple-based mobile development.

"Swift 3 is a source-breaking release over Swift 2.2.1," Apple said in a blog post Monday. "It contains many syntactic refinements and improvements, but also a huge number of changes for how Objective-C APIs import into Swift due to SE-0005. That SE-0005 document concerns "Better Translation of Objective-C APIs Into Swift."

After it was open sourced in December, the incremental update Swift 2.2 was released in March with open source contributions. "Notably, the release includes contributions from 212 non-Apple contributors -- changes that span from simple bug fixes to enhancements and alterations to the core language and Swift Standard Library," Apple said at the time.

The Swift 3.0 Developer Preview 1, however, sees an increase in community involvement. "The big news is that this is the first release that has much broader Swift community support as opposed to improvements being purely Apple's agenda," Blockstream developer Christopher Allen told InfoWorld. "Most of the changes are to improving dealing with legacy Objective-C APIs and names and otherwise attempt to make syntax more consistent across the language."

 Swift Project Organization on GitHub
[Click on image for larger view.] Swift Project Organization on GitHub (source: Apple)

Apple, which announced the Swift 3.0 preview during its Worldwide Developers Conference (WWDC) 2016 underway in San Francisco, touched on that idea in a conference presentation titled "What's New in Swift." In the session, Apple's Ted Kremenek and other presenters explained new features and emphasized community participation.

"Swift was released as an open source project just six months ago," Kremenek said. "And a big part of doing that was not to just shove out a bunch of sources to GitHub, but to create a fully open community that drives the evolution of Swift going forward. Swift 3 is the first major update of Swift that is intended to be a product of that community."

"Swift has been going through some iterative refinement and sculpting over the last few releases, based a lot on feedback from developers who are using it, and also as you'll see from the Swift community since it was open sourced," Kremenek continued. "A big thing about Swift 3 is that we really want to get those core fundamentals into shape so we can really build on top of them going forward."

The broad community support for Swift 3.0 is demonstrated at the project's GitHub site, which lists 346 contributors. While the vast majority of heavy contributors seem to come from Apple, it doesn't take too much poking around to find multiple contributions from developers working for other companies and even from students.

Kremenek explained how Apple handles the open source development of Swift, something that might be foremost in many potential contributors' minds in view of widely reported discord among volunteer in several open source projects, like Debian.

"Now how we run the project is really important," he said. "It's meant to be very egalitarian. We want it to be a very open process and transparent and free, and everyone can really participate in driving the language forward. And they can see the rationale why changes were made. This is really important. And so all changes to the language, whether you're someone who works at Apple or you're someone out there who is writing apps and you have an idea on how to contribute to change Swift, it works exactly the same way. And I think this is really, really, important. And it also means that non-Apple engineers do have direct access to commit to the compiler and all those repositories. And so we really want to empower the community to drive Swift forward."

Apple codifies that philosophy on the GitHub project site. "To be a truly great community, Swift.org needs to welcome developers from all walks of life, with different backgrounds, and with a wide range of experience," the site states. "A diverse and friendly community will have more great ideas, more unique perspectives, and produce more great code. We will work diligently to make the Swift community welcoming to everyone." Apple clarifies its expectations of community developers in a Code of Conduct.

Concerning development of the language itself, besides the aforementioned legacy Objective-C API issue, the Swift 3.0 preview project contains a host of other changes, ranging from removing ++ and -- operators to Swift testing and API design guidelines.

Note, however, that some of these might not be appearing in their final form.

"As described in the Swift 3.0 Release Process, developer previews (i.e., 'seeds' or 'betas') provide qualified builds of Swift 3 that are more stable than just grabbing the latest snapshot of master (i.e., tip-of-trunk development)," Apple said in its blog post announcing the preview. "Developer previews capture Swift 3 as a work-in-progress and should not be considered the final version of Swift 3 unless otherwise stated."

Going forward, Kremenek's co-presenter Chris Lattner said a major goal of further Swift development is source compatibility, which he said is the most popular "feature" request from developers, and which is especially critical for cross-platform development. Source compatibility between Swift 3 and 4 was described as "a very strong goal."

"Our No. 1 goal for Swift 3 is source compatibility," Lattner said. "That's a big goal. That means we want to look at what kind of code you write in your applications and make sure that when Swift 3 comes out, that's the right way going forward. And this is actually a really hard problem. This isn't just a matter of do we use commas or do we use colons or that kind of stuff." Rather, he said, the management of APIs is an example of an especially complicated and important issue among the many that need to be considered.

To ensure further development is coordinated and compatible, Apple is relying upon the Swift Programming Language Evolution guidelines outlined in a GitHub project. It outlines goals for upcoming Swift releases, the Swift evolution review schedule that tracks proposals to change source code, the Swift evolution process and Commonly Rejected Changes, which shows proposals that have been denied.

"The primary goal of this release is to solidify and mature the Swift language and development experience," that project site states. "While source breaking changes to the language have been the norm for Swift 1 through 3, we would like the Swift 3.x (and Swift 4+) languages to be as source compatible with Swift 3.0 as reasonably possible. However, this will still be best-effort: if there is a really good reason to make a breaking change beyond Swift 3, we will consider it and find the least invasive way to roll out that change (e.g. by having a long deprecation cycle)."

Developers interested in contributing to Swift development can consult the Contributing to Swift Guide.

About the Author

David Ramel is the editor of Visual Studio Magazine.

Featured

Most   Popular
Upcoming Events

AppTrends

Sign up for our newsletter.

I agree to this site's Privacy Policy.