AsyncCompatibilityKit
AsyncCompatibilityKit copied to clipboard
iOS 13-compatible backports of commonly used async/await-based system APIs that are only available from iOS 15 by default.
Looks like this is working fine. Thanks for making this!
While testing my unit tests (which were working fine on iOS 15) with the back ported version of `URLSession.data(for:)` from `AsyncCompatibilityKit` the cancelation test stopped working even though the package...
Actor
* The use of the `onCancel` closure is hiding the fact that the completion handler is `@Sendable`, whereas `onCancel` is not. * If you define `onCancel` to be `@Sendable`, it...
Thank you for this! I used this in a multiplatform test project. I needed to change a few things for macOS support. - Change package platforms to support Catalina and...
Download
Add download tasks * Note, though, that unlike the data task, I made the method name distinct (using `with` rather than `for`/`from`). * Should the data task also use unique...
I'm trying to use this in a package that needs to be compatible with iOS 12, but simply integrating `AsyncCompatibilityKit` results in an error: The fix: Add `introduced: 13.0` to...
This PR ensures thread safety when a `URLSession.data(for:)` task is canceled. ### Issue 1. Thread 1 calls [withTaskCancellationHandler(operation:onCancel:)](https://developer.apple.com/documentation/swift/withtaskcancellationhandler(handler:operation:)). 2. Thread 2 invokes [Task.cancel()](https://developer.apple.com/documentation/swift/task/cancel()), so the `onCancel` block runs immediately on...