Tuesday, September 20, 2016

Swift 3 Notes

Ted Kremenek (Hacker News):

Swift 3.0, the first major release of Swift since it was open-sourced, is now officially released! Swift 3 is a huge release containing major improvements and refinements to the core language and Standard Library, major additions to the Linux port of Swift, and the first official release of the Swift Package Manager.

It’s great that he links to all the enhancement proposals.

Ole Begemann:

This is an excerpt from the Strings chapter in Advanced Swift. Chris Eidhof and I are currently updating the book for Swift 3 (and improving it in the process). This section on strings was originally written by Airspeed Velocity for the first edition of the book, and Chris and myself updated it for the upcoming edition.

Ole Begemann:

Trick question: does a string in Swift 3 always contain its prefix?

Ole Begemann:

In Swift 2, ranges were closely connected to collections. A range’s element type had to be an index type, and ranges themselves were also collections. This model underwent significant changes in Swift 3 as part of the new collection indexing model. Because the old index protocols no longer exist, the only constraint on a range’s element type is now Comparable conformance. And since the range elements now can no longer advance themselves, it follows that Range can’t be a Collection anymore, at least not without additional constraints. As a matter of fact, the Range type in Swift 3 is closer in concept to what used to be called intervals in Swift 2.

Erica Sadun:

I am really happy with how SE-0094 turned out. I helped with the paperwork but it was all Kevin Ballard‘s brain child, putting together the two new sequence functions. If you haven’t been playing with these yet, they’re available in the latest developer snapshots (both the main trunk and the public branch) and they’re delightful.

Brent Simmons:

Note that the Objective-C name SomethingHappenedNotification becomes just .SomethingHappened in Swift, and it’s automatically a Notification.Name.

Nick O’Neill:

These are just some of the big items you’ll run into when looking at your diffs after running the Xcode automatic migration.

Matt Gallagher:

This article is my response to the question of the week: “how much work is involved in migrating to Swift 3?”


I really wish I could say anything in this article [Exponential time complexity in the Swift type checker] had changed but the compiler issues described all remain exactly as is.

Natasha Murashev:

So although the Swift 3.0 upgrade is very painful, it is also a good time to notice all those repetitive things in your code and refactor.

Erica Sadun:

Swift 3 is a major, breaking language change. Are you ready to make the jump? Let “Swift from Two to Three” help you along the way. From migrating your code, updating your style, and adopting new Swift features, this book ushers you into the newly refreshed language. Learn what changed, why it changed, and how you can update your code using this hands-on guide that covers all the major difference with plenty of examples and insight.

There’s a Reddit thread about people’s experiences updating.

Update (2016-09-28): Keith Harrison:

Swift 3 has brought us some interesting access control changes. The differences between open and public or private and fileprivate take some getting used to. Luckily unless you are writing a framework the new rules are simple. Here is what you need to know.

1 Comment RSS · Twitter

Leave a Comment