Thursday, October 28, 2021 [Tweets] [Favorites]

Swift Concurrency for Older OS Versions

Xcode 13.2 Beta:

You can now use Swift Concurrency in applications that deploy to macOS 10.15, iOS 13, tvOS 13, and watchOS 6 or newer. This support includes async/await, actors, global actors, structured concurrency, and the task APIs.

See also: Swift concurrency back deployment. The memory corruption issues are apparently fixed, too.

Previously:

Update (2021-10-29): John Sundell:

Although Swift 5.5’s new concurrency system is becoming backward compatible in Xcode 13.2, some of the built-in system APIs that make use of these new concurrency features are still only available on iOS 15, macOS Monterey, and the rest of Apple’s 2021 operating systems.

[…]

Thankfully, the above problem is something that we can fix ourselves, since Swift’s new concurrency system ships with a continuation mechanism that lets us retrofit existing code with async/await support.

Here’s how we could use that mechanism to replicate the above async/await-powered URLSession API in order to make it available all the way back to iOS 13[…]

Comments

Stay up-to-date by subscribing to the Comments RSS Feed for this post.

Leave a Comment