So you’ve no doubt heard there’s a new Swift coming, and asked yourself What’s new in Swift 3.0?
Swift 3.0 is changing pretty much everything, and your code will almost certainly refuse to build until you make the necessary changes. Seriously, if you thought the jump from Swift 1.2 to 2.0 was big, you ain’t seen nothing yet.
Didn’t we go through this already … why yes. Yes, we did.
In this article, I’m going to explain some of the most important changes with as many code examples as I can, and, hopefully, this will give you some chance to be prepared to update your code when Swift 3.0 goes final. There are many more changes than the ones listed below, but the changes below are the ones that are most likely to hit you…
It’s like the Guaranteed Swift Programmer Employment Act! But don’t get too worked up, we completely agree with the conclusion of that article:
It’s easy to read these changes, some of which are tiny but introduce massive breakage, and imagine that Apple’s Swift engineers are just out to make our lives harder. However, the truth is that they are working hard to make sure Swift is as easy to learn, easy to use, and fast as possible, which are three very different priorities.
In particular, I have been struck by how committed the Apple team are to ensuring their changes are discussed and agreed in the open, as part of the Swift Evolution community effort. Every change above went through extensive community discussion before being agreed for Swift 3.0, which is an incredible thing to behold.
You can get involved and help shape these changes going forward: they are keen to hear ideas from a wide range of users, and it means the future of Swift really is in your hands.
So yes. If you’re writing or maintaining Swift code — and who isn’t? — we MOST strongly recommend you read this article thoroughly, and soon. Even better, get an early jump with How to install Swift 3 today and this sample project for instance. Although we’d figure that a Swift 3 running Xcode is pretty likely to show up on the first day of WWDC 2016, so no need to get too worked up there.
Speaking of the evolution of Swift, there’s also been a great deal of heartfelt concern voiced recently about a) ABI compatibility being missed in 3.0, and b) Swift never getting @objc on its cross-platform incarnations as the current plans lack, and what that lack of runtime dynamism means. (Spoiler: Horrible things.) Around here, we’re just fine with a) taking as long as it takes to get right, and with b) we’re pretty sanguine that something functional (geddit?) which fits the Tao of Swift will show up to address common use cases, but others find it a far more pressing concern. Great round up by Michael Tsai:
Read that if you need to get involved in a good internet fight! Or even if you’re not, there’s still a lot of good conceptual discussion there, if you’ve got some time being familiar with the debate is worthwhile we’d say.
And speaking of being familiar with the debate, prepare yourself for Swift advocacy by checking out
I strongly believe Swift is the future of iOS development. It’s only a matter of when, and the blocker is the breakneck speed it evolves. For smaller apps, Swift is good enough. For big apps, it’s at least a year away…
Let’s all see what we can do to push that forward!