Xcode 13.2 Beta release notes features a promise for Swift Concurrency support for iOS 13.
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. (70738378)
However, back in Summer 2021 when it first appeared at WWDC it was hard constrained to be run on iOS 15+ only.
My question is: what changed? How did they achieve backwards compatibility? Does it run in any way that is drastically different from the way it would run in iOS 15?
Concurrency is the process by which a computer or individual program can perform multiple tasks simultaneously, including executing tasks or processes in the background.
Swift 5.5 introduces a new way to write concurrent programs, using a concept called structured concurrency. The ideas behind structured concurrency are based on structured programming, which so intuitive that you rarely think about it, but thinking about it will help you understand structured concurrency.
Xcode 13.2 requires a Mac running macOS 11.3 Big Sur or later.
Overview. Xcode 13 includes SDKs for iOS 15, iPadOS 15, tvOS 15, watchOS 8, and macOS Big Sur 11.3. The Xcode 13 release supports on-device debugging for iOS 9 and later, tvOS 9 and later, and watchOS 2 and later. Xcode 13 requires a Mac running macOS 11.3 or later.
A bug in the Mac App Store version of Xcode 13.2 is causing problems for developers, who are reporting package errors and issues with compiling projects. Apple released Xcode version 13.2 on Monday alongside iOS 15.2 and other software updates. However, some developers began noticing a bug in the version available from the Mac App Store.
Additional capabilities cited in Xcode 13 beta release notes include: Native support for concurrent programming with the Swift language and Swift package collections. Swift 5.5 natively supports concurrent programming using async/await and actors.
Apple released Xcode version 13.2 on Monday alongside iOS 15.2 and other software updates. However, some developers began noticing a bug in the version available from the Mac App Store. One developer noticed that the new version of Xcode made their Swift packages unavailable. Additionally, the developer added that Xcode wouldn't compile anything.
The Xcode 13.2 update includes software development kits for iOS 15.2, iPadOS 15.2, tvOS 15.2, watchOS 8.3, and macOS Monterey 12.1 and allows for on-device debugging on iOS 9 and later. It appears that the issues are only affecting the Xcode 13.2 update from the Mac App Store.
Back-deploying concurrency to older OS versions bundles a concurrency runtime library along with your app with the support required for this feature, much like Swift used to do with the standard library prior to ABI stability in Swift 5, when Swift could be shipped with the OS.
This bundles parts of the Concurrency portions of the standard library (stable link) along with some additional support and stubs for functionality (stable link).
This bundling isn't necessary when deploying to OS versions new enough to contain these runtime features as part of the OS.
Since the feature on iOS 15+ (and associated OS releases) was stated to require kernel changes (for the new cooperative threading model) which themselves cannot be backported, the implementation of certain features includes shims based on existing functionality which does exist on those OSes, but which might perform a little bit differently, or less efficiently.
You can see this in a few places in Doug Gregor's PR for backporting concurrency — in a few places, checks for SWIFT_CONCURRENCY_BACK_DEPLOYMENT
change the implementation where some assumptions no longer hold, or functionality isn't present. For example, the GlobalExecutor
can't make assumptions about dispatch_get_global_queue
being cooperative (because that threading model doesn't exist on older OSes), so when backporting, it has to create its own queue for use as the global cooperative queue. @objc
-based actors also need to have their superclass swizzled, which doesn't need to happen on non-backdeployed runtimes. (Symbols also have to be injected in some places into the backdeploy libs, and certain behaviors have to be stubbed out, but that's a bit less interesting.)
Overall, there isn't comprehensive documentation on the exact differences between backdeploying and not (short of reading all of the code), but it should be safe to assume that the effective behavior of the backdeployed lib will be the same, though potentially at the cost of performance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With