What's New in Swift 4
September 28, 2017
Swift 4 has been released and I've created What's New in Swift 4, a short video hosted by the great folks at Realm.
When Swift was first released just a few years ago people grumbled on both sides.
Some complained that Apple released it too soon. They didn't feel that the language was ready yet and now early adopters would have to suffer through the growing pains of the language.
Sure. That's kind of what early adopters sign up for.
Others complained that Apple didn't release it sooner. Their argument was that Apple just dropped this on us. They should have open-sourced it and taken advantage of community input.
I think it's hard to strike the right balance, but I think - whether on purpose or by accident - Apple found it with the Swift release.
The first release of Swift was a bit rough but it showed us what the language wanted to be. We could get in and get our hands dirty and learn the syntax and start to get a feel for the language's point of view.
We knew we had time, but if Apple was behind the language this was the language we'd need to use for iOS developments.
Swift 2 addressed many of the holes in the first release and made some changes. Of course people complained. You filled holes but that's not what we wanted. We don't want that Error thing we want our Result enum instead.
In Swift 2 we got protocol extensions and heard Apple say clearly at WWDC that they saw Swift as a protocol oriented language.
On the one hand, that doesn't mean that that's what Swift is.
Poets write poems, novelists write books, and composers write songs only to be told by their audiences what their creations mean.
On the other hand, it was a useful insight into how some of the people internally at Apple viewed the language and explained changes to map(), filter(), and reduce() in Swift 2. Kind of fun to see protocol oriented programming paying off by serving requests functional programmers.
More people started to do their everyday work in Swift. Some complained about the tooling. Others complained about the language. Still others complained about the fact that Apple was too stubborn to open source the language.
Then Apple open sourced the language.
Open source people who weren't writing in Swift anyway complained that it wasn't open enough.
Please.
I remember the early days of Java.
I remember JSRs.
Many of the people complaining that Swift wasn't open enough are misremembering what open meant in the Java community - and what might never have happened without the work of the Apache Foundation.
Swift 3 was supposed to be the release when we got ABI stability.
This was an important goal.
But Apple did something - whether on purpose or by accident - that was way more important. They listened to the community proposals and worked with the community to shape the language and make changes in response to the proposals. Apple also added a lot of functionality and made changes to the language that made porting from Swift 2 to Swift 3 fairly painful.
Those people who wanted Apple to wait until Swift was more mature couldn't wait to say, "I told you so."
More accurately, they didn't wait to say it.
I've been happy with Swift 3 and I'm even happier with Swift 4.
There are small changes that make me happy: one sided ranges in arrays, Strings are collections, and Dictionary's filter() works as expected and it now has mapValues.
Mainly, it just feels as if the language knows what it wants to be when it grows up. There are long term goals for generics, ownership, and (though not worked out yet) asynch coding.
We are at a point where we have more of a feel of what it means to write idiomatic code.
Most importantly, we're no longer in a hurry.
Three years ago it was "Bang, here's our new language."
Now that the community is included more in the discussion we can see the everyday work of growing and caring for a language.
Swift will most likely not be the last language I ever write code in, but I'm pretty happy with where it is and where it's going.