Paul Krill
Editor at Large

Swift 5.5 introduces async/await, structured concurrency, and actors

news
Sep 22, 20212 mins

‘Massive’ upgrade to the Apple-developed programming language also brings new package management capabilities.

Swift 5.5, the latest version of Apple-developed language intended to replace C-based languages, has been published with capabilities centering on concurrency and package collections.

Described in a September 20 bulletin as a “massive release,” Swift 5.5 can be accessed from swift.org. The release offers concurrency interoperability with Swift predecessor Objective-C, a proposal that bridges Swift concurrency features and the convention-based expression of asynchronous functions in Objective-C. The goal is to allow asynchronous Objective-C APIs to be immediately usable with Swift’s concurrency model.

Although modern Swift development involves a lot of async programming, the APIs have been hard to use, the project notes. An async/await capability in Swift 5.5 defines the semantics for asynchronous functions. This proposal is intended to make the whole process more natural and less error-prone. Swift async/await also can be used to write and use functions that return many values over time. This work was done via the Async/Await Sequences proposal.

Another new feature, structured concurrency, is described in release notes as enabling concurrent execution of asynchronous code with a model that is ergonomic, predictable, and admits efficient implementation.

Other new capabilities in Swift 5.5:

  • For the Swift Package Manager (SwiftPM), the concept of Package Collections is introduced to the package ecosystem. Collections are authored as static JSON documents and contain a list of packages and additional metadata per package. These are published to a web server or CDN-like infrastructure. SwiftPM gains a new command-line interface for adding and removing collections and will index them in the background, enabling users to more easily discover packages in the collections.
  • Actors are introduced. An actor serves as a reference type (actor) that protects access to its mutable state.
  • Property wrappers, introduced in Swift 5.1 to abstract away common accessor patterns for properties, are being extended to function parameters and closure parameters. Previously, this capability was limited to local variables and type properties.
Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author