Swift 4.0 is finally here! So now everyone can relax, right? 😅 Ha. ABI Stability isn’t going to implement itself! 😆 There’s a lot of work ahead. We saw some progress here this week with Jordan Roses’s proposal on non-exhaustive enums. Also, there were some improvements to KeyPaths and the start to recursive protocol constraints.

Swift 4 landed along with Xcode 9, iOS 11, tvOS 11, and watchOS 4. This only leaves macOS High Sierra, which will be out in a few days. Good lucking with migrating your code bases if you haven’t started already. Over at PlanGrid, we decided to move to Swift 3.2 during the betas and move to Swift 4.0 after the final release. I have a work-in-progress branch doing the migration now and it’s not too bad, but definitely not trivial.

Interested in sponsoring Swift Weekly Brief? Learn more here.

Swift Unwrapped

In Episode 29 we discuss some recent Swift Evolution proposals, Xcode 9 GM, along with a boatload of follow-ups from Ted Kremenek and Pierre Habouzit.

News and community

Ted Kremenek published the official Swift 4.0 announcement on the Swift.org blog. Congrats to Ole Begemann for getting a shout out in the opening paragraphs!

Swift 4 is now officially released! Swift 4 builds on the strengths of Swift 3, delivering greater robustness and stability, providing source code compatibility with Swift 3, making improvements to the standard library, and adding features like archival and serialization.

You can watch a quick overview of it by watching the WWDC 2017: What’s New in Swift presentation, and try out some of the new features in this playground put together by Ole Begemann.

Mike Ash has a great post on The Best New Features in Swift 4, in case you forgot. 😆

Brian Gesiak continued his Swift compiler series with Reading and Understanding the CMake in apple/swift.

Commits and pull requests

Joe Groff merged his work on KeyPath subscripts. (Tweet)

Doug Gregor opened a pull request to implement the standard library part of SE-0157: Recursive Protocol Constraints.

Calvin Hill added initial platform support for building swiftc and the stdlib on 64bit Haiku OS, which I assume is Greg Heo’s favorite operating system. 😆 Anyway, this brings Swift one step closer to world domination.

Will T. Ellis added a refactoring action to collapse nested if statements into a single if statement. (SR-5739) This is the first external contribution to the Swift local refactoring tools. 🎉

Jordan Rose eliminated the last direct use of Builtin.UnknownObject. “At the Swift level, this is equivalent to AnyObject, which we’ve done much more testing of. This commit paves the way for taking UnknownObject out of the SIL type system and just using it as type metadata.”

Joe Groff wrote a script to generate random type definitions. The intent is to use this to generate input for fuzzing runtime layout, ABI compatibility, layout algorithms, and more. Unfortunately, it was written in Python, not Swift.

Amr Aboelela opened a pull request for corelibs-libdispatch that adds a build-android script, which will build libdispatch for Android.

Proposals in review

SE-0186: Remove ownership keyword support in protocols by Greg Spiers is under review.

This proposal removes support for the keywords weak and unowned for property declarations in a protocol.

Currently it’s possible to use the weak/unowned keywords for a property requirement in a protocol. This can lead to confusion as specifying one of these keywords does not enforce or raise any warnings in the adopting type of that protocol…

Proposal drafts

Jordan Rose drafted a proposal for non-exhaustive enums. You can find the work-in-progress implementation here. Determining how to address and design this is one part of Swift’s ABI stability story.

Currently, adding a new case to an enum is a source-breaking change, which is very inconvenient for library authors. This proposal aims to distinguish between enums that are exhaustive (meaning they will never get any new cases) and those that are non-exhaustive, and to ensure that clients handle any future cases when dealing with the latter. This change only affects clients from outside the original module.

Mailing lists

Ted Kremenek announced Swift 4.0.

I am pleased to announce that Swift 4.0 has been officially released.

Swift 4 is available in Xcode 9 (which went live on the Mac App Store earlier today) and we will be posting an official toolchain shortly as well (likely early tomorrow morning).

Official builds have been posted for Linux (Ubuntu 16.10, Ubuntu 16.04 and Ubuntu 14.04). For those of you downloading the Linux builds, please note that there is a new signing key (search for ‘Swift 4.x Release Signing Key’) on the downloads page

Thank you to everyone who contributed to making this release happen!


And finally — artificial intelligence, 5 cents.