Swift concurrency back deployment

Doug Gregor, a member of the Swift team at Apple, recently opened a PR that adds an option to build the Swift 5.5 Concurrency libraries for older versions of macOS/iOS. This PR generated a lot of interest amongst the Swift community, with people wondering if Swift's new concurrency model would soon be available for use in older OS versions. In this post to the Swift forums, Doug explains the changes contained in his PR.

Add an option to build the concurrency library for back deployment

Implemented by Doug Gregor, a member of the Swift team at Apple, this unexpected pull request adds an option to build the new Swift Concurrency libraries for older versions of macOS/iOS. These libraries can then be embedded in targets deployed before macOS 12/iOS 15 to support the new concurrency features. I'm still not sure if this makes the new concurrency features fully available when working with older OS versions, but this is something to watch.

Converting closure-based code into async/await in Swift

Existing Swift APIs often provide asynchronous code execution using callback closures or delegate methods, which allow the caller to define what happens when the asynchronous task has finished. Swift's new concurrency model enables us to create similar asynchronous APIs using async/await and also provides methods for interfacing async/await with existing callback-based or delegate-based asynchronous APIs. In this post from his Modern Concurrency in Swift series, Andy Ibanez explains what continuations are and shows us how to use them to bridge from closure-based or delegate-based APIs to async/await.