Apple has just released Swift 5.5, a significant update to its open-source programming language for iOS, macOS, iPadOS, and watchOS. As with every Swift update, the big question is whether these new, more robust features will encourage more developers to begin using the language.
The new features include:
- Async/await
- Async sequences
- Effectful read-only properties
- Structured concurrency
- Async let bindings
- Continuations for interfacing async tasks with synchronous code
- Actors
- Global actors
- Sendable and @Sendable closures
- if for postfix member expressions
- Allow interchangeable use of CGFloat and Double types
- Codable synthesis for enums with associated values
- Lazy now works in local contexts
- Extend property wrappers to function and closure parameters
- Extending static member lookup in generic contexts
On Hacking with Swift, Paul Hudson breaks down some of the features’ utility, including async/await, which allows developers to “run complex asynchronous code almost [as] if it were synchronous.” If you’re interested in coding with Swift, give his article a read, as he shows how 5.5 solved some of the biggest issues confronting developers who use the language.
“The Swift team are working extraordinarily hard to deliver an astonishing collection of changes in a relatively short time,” Hudson added. “Not only are these changes providing major new language features that deliver power and safety for Swift developers, but they have also received extensive community input through Swift Evolution—the actors proposal alone went through seven pitches and two proposals before finally being approved.”
If you’re new to Swift, it’s helpful to learn arrays, sets, strings, structs and classes, functions, and more. Swift Playgrounds is a good place to start for many budding technologists, as it attempts to make learning the language into a fun, interactive activity.
Apple rolled out Swift in 2014, and positioned it as a replacement for Objective-C, the programming language that powered the Apple ecosystem for decades. However, Objective-C has managed to hang onto a user base, thanks in part to all the legacy code in need of updating and maintenance. With each new version, Swift gains features designed to make it a more robust and powerful language—but it hasn’t managed to totally swallow up its predecessor’s market-share, a process that could still take years. Perhaps Swift 5.5 will convince even more developers to finally embrace it.