-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swift Concurrency Support #3463
Conversation
|
所以这个 async/await 的特性只能用在 iOS15+ 吗? |
|
Right now, yes, the Swift Concurrency features are only available on the 2021 OS versions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
现在,是的,Swift 并发功能仅在 2021 OS 版本上提供。
It's hard to understand why this feature wasn't embedded in Swift5.5,
why do you think it was bundled with the OS.
You can read more about the issue on the Swift Forums. |
Wow, thanks for your reply. |
c659c88
to
c63277d
Compare
|
Is there any way to wrap completion handlers in the meantime? https://stackoverflow.com/questions/68694917/convert-alamofire-completion-handler-to-async-await-swift-5-5/68694995#68694995 |
7034f95
to
3784cf7
Compare
51abfc4
to
fdc7f74
Compare
|
Any ETA when it will be merged? btw, now concurrency will be supported from iOS 13 since xcode 13.2. |
fdc7f74
to
cac298b
Compare
|
Right now I'm aiming to release before Xcode 13.2 ships so we can require it for the Concurrency support. However, this is pending proper test integration, which I'm having some trouble with, so hopefully we'll have some fixes in Xcode 13.2 as well. |
cac298b
to
9cff58b
Compare
|
The recent update to this branch requires Xcode 13.2, as there's no way to deploy versions of async code that can deploy back to the 2019 OSes and the original deployment targets at the same time. Naming has also been updated, as well as the addition of configurable cancellation handling. I hope to round out the various types of support soon. |
|
Will there be some example code on how async should/inteaded to be used with Alamofire? |
|
Yes, updated docs will be part of this PR. |
4233106
to
c76809b
Compare
|
Hello, |
|
I've added some summary documentation to our AdvancedUsage document, as well as extensive inline documentation. Please let be know if there are any additional questions that can be answered in the docs. This work will be merged and released as soon after the release of Xcode 13.2 as I can manage. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great @jshier! Great work across the board!
* Add Concurrency support. * Remove misleading Protected convenience APIs. * Safer NSLog usage. * Project updates. * Disable thread sanitizer during development. * Update tests for new APIs. * Add concurrency tester. * Fix concurrency runner. * 15.2 simulator for concurrency tests. * Disable thread sanitizer on iOS as well. * Update inline docs, add stream cancellation. * Add documentation. * Document async value handlers. * Remove TODO. * Add doc comment. * Target the concurrent queue for the streams. * Rename finishObservers to finishHandlers.
Goals ⚽
This PR tracks the implementation of Swift Concurrency support as an extension to Alamofire. This ensures it remains buildable on all platforms.
Implementation Details 🚧
Additions:
DataTask, which encapsulates the originatingDataRequestand aTaskwhich tracks an underlying continuation for async work. It also provides async access to theresponse,result, andvalueproperties, as well as read-only access to the properties of the underlyingDataRequest.DownloadTask, which does the same forDownloadRequest.DataStreamTask, which encapsulates aDataStreamRequestand vends customStreamOfvalues for the stream output. Unlike the data and download cases, this task doesn't trigger the request immediately, only once a stream has been requested.Testing Details 🔍
Tests added for all task types.