How To Keep Up with Swift Changes
How do you deal with Swift changes as you’re learning how to code iOS apps? It’s a frustration that many beginner iOS developers share. When I recently asked iOS developers for their biggest challenges, here’s a comment I got:
The fact that Apple is CONSTANTLY changing Swift!!!
The liberal use of all-caps and exclamation marks says a lot…
The Swift programming language is powerful, innovative and always in flux. The same is true for SwiftUI. How do you keep up, avoid learning outdated information, and stay up-to-date on latest improvements? We’ll find out in this tutorial.
- How Often Does The Swift Language Change?
- How To Deal with Outdated Information
- How To Keep Up with Swift Changes
- Further Reading
How Often Does The Swift Language Change?
But is Apple constantly changing Swift? Here’s the version history for every major Swift version since the language’s inception in 2014:
|September 9, 2014||Swift 1.0|
|October 22, 2014||Swift 1.1|
|April 8, 2015||Swift 1.2|
|September 21, 2015||Swift 2.0|
|March 21, 2016||Swift 2.2|
|September 13, 2016||Swift 3.0|
|September 19, 2017||Swift 4.0|
|March 29, 2018||Swift 4.1|
|September 17, 2018||Swift 4.2|
|March 25, 2019||Swift 5.0|
|September 10, 2019||Swift 5.1|
|March 24, 2020||Swift 5.2|
When looking at the release dates, a few patterns stand out:
- Major versions, i.e. 1.0, 2.0, etc. are released in September
- Minor versions, i.e. 1.x, 4.x, etc. are released in March
- Since 2014, Swift has at most changed twice a year: once a year for major updates (4.0, 5.0) and once for minor updates (4.x, 5.x)
Where does the idea that Swift constantly changes come from?
- In 2016 Swift 2.2 and 2.3 were released, leading up to the release of Swift 3.0. The changes between Swift 2 and 3 were incompatible (“breaking”), and that meant you’d have to rewrite several parts of your code to upgrade. Without these upgrades, your code wouldn’t compile or run.
- Xcode has a “migration tool” that can help you upgrade your code to a new Swift version. Even though the tool is helpful, it isn’t 100% automatic. You’ll have to review every change it suggest, and it doesn’t always spot every required upgrade.
- The upgrade from Swift 2 to Swift 3 affected functions that matter to beginner iOS developers, because they renamed and restructured a lot of Swift and Objective-C functions. If you were learning Swift when the change from 2 and 3 happened, you most likely had to relearn a whole lot of things.
The advances of the Swift programming language in versions 4 and 5 largely focused on so-called “ABI stability”. ABI stability enables binary compatibility between apps compiled with different Swift versions.
Without going too deeply into this topic, it basically ensures your app, compiled with an older version of Swift, still runs on a device that has a newer version of Swift.
Later Swift versions don’t have those breaking changes. Since Swift 4, versions are interchangeable, so you can use both in the same Xcode project. That means your code still runs, even when you upgrade, and you can slowly incorporate new syntax in your old codebase. Neat!
Note: Apple uses their bi-yearly product marketing schedule for the Swift language too. In the spring, Apple has their Worldwide Developers Conference, and in the fall, they often have a Special Event or keynote with product upgrades. New Swift versions follow the same structure.
How To Deal with Outdated Information
Beginner iOS developers often rely on Stack Overflow to get help with coding problems. Developers simply look up Swift syntax on Stack Overflow, and copy-and-paste the code they find straight into Xcode.
Guess what happened when Swift 3.0 was released? The code you found on Stack Overflow wouldn’t work, because it was written in Swift 2.1. Your Xcode needed Swift 3.0, so you were stuck rewriting a bit of code to the newer version. And that sucks!
I also think that the various “What’s Changed In Swift 3?” blog posts were a contributing factor to the confusion. These articles mostly list changes in Swift on a conceptual basis.
If you’re a beginner, and you read that the increment/decrement operators have been replaced in favour of the addition assignment operator, do you really know what is going on?
When learning something new, you need a “hook” to connect new information onto. This is how our mind works. When you don’t have that hook, i.e. when you can’t place a Swift change, you’re less likely to learn something.
- The Swift programming language doesn’t change that much, except that in 2016 it changed a lot, and in big ways
- Developers often copy-and-paste code from Stack Overflow, and when that code is written for an older Swift version, it’s likely to produce errors
- “What’s Changed?” blog posts explained exactly what their titles said they would, except that they didn’t help beginner iOS developers adopt these changes in their learning
How To Keep Up with Swift Changes
And that, fellow developer, is how the idea that Swift constantly changes got into this world. It doesn’t even change that often – but when it does, the world is slow to adopt the change…
So how do you keep up with Swift changes? A new Swift version is around the corner, and a ton of tutorials and Stack Overflow answers are still written for older versions. In fact, they have never been updated!
How do you deal with that?
Invest in a Good Course or Book
First off, I recommend you invest in a premium course or book on iOS development. When you solely rely on free iOS tutorials to learn app development, you’re guaranteed to find outdated information.
Most websites that have iOS tutorials make money from advertisements. This doesn’t incentivise them to update these tutorials, because they don’t make money when the information is helpful – only when it’s seen by a visitor.
Courses that promise you to keep information up-to-date have an incentive to update their information, because no customer wants to pay for outdated information. Likewise, books need to get a regular updates, or subsequent sales dwindle.
If you’re looking for an immersive course that has 1-on-1 support, a community, and real-world projects, I recommend my own iOS development course.
Get Better at Learning iOS Development
If you want to be a professional iOS developer, you better get used to things that change. Swift isn’t the only thing that changes – frameworks, libraries and SDKs change too! Alamofire, CocoaPods and tools like Fastlane change all the time.
Things that worked yesterday aren’t guaranteed to work today. In fact, I would go as far as to say that “change” is one of the biggest challenges of our profession. One day your code works, the next day it doesn’t.
Deal with it! Practice your curiosity, problem-solving skills and innovate. Things that stay the same are boring. Learn fundamental topics; they never change. Oh, and quit the habit of copy-and-pasting your code. You learn little that way!
Keep an Eye Out for Updates, News and Changes
Staying up-to-date is something you need to do actively. I bet that if you learn the intricacies of a Swift version change, you’ll become a better software engineer as a result.
The necessity of needing to understand what a nil-coalescing operator is, is exactly what leads to a deeper understanding of a programming language.
Between Swift 3 and 4, the handling of strings changed. That was an opportunity for me to dive into UTF-8 and Unicode, and how scalars work, and why exactly Swift allows you to use emojis as variable names.
It sounds cute, but it isn’t – it’s awesome software engineering. I learned a lot that day, and that’s a habit you want to cultivate!
Where do you listen in on Swift changes? I’ve included some spots to put your ear to the ground, below.
- Swift Evolution (this one in particular!)
- Swift Language Guide
- Swift Standard Library
- Apple Developer Documentation
I hope that you now understand that Swift doesn’t change that often, and not that much.
It’s just that the past changes had a big impact on how beginner iOS developers learn the language. It’s something you gotta embrace, because it makes you a better software engineer. And keep an eye out for next March and September!
Want to learn more? Check out these resources:
- Going from Coding Tutorials to Building Your Own App Projects
- How To Learn iOS App Development
- Get Started with SwiftUI for iOS
- How To Use Apple’s Developer Documentation For Fun And Profit
- The Right Mindset For App Developers
- The Swift Cheatsheet (Updated!)
- How To Use Swift Optionals: The Ultimate Guide
- Generics in Swift Explained
- How To: Xcode 11 Tutorial for Beginners
Code Swift right in your browser!
Go to the Swift Sandbox