Alamofire + Swift Concurrency

Support for the Swift Concurrency features has been implemented for DataRequests and is tracked in this draft PR. You can now await requests in Alamofire through the production of DataTask values, which encapsulate an underlying Task.Handle and DataRequest.

let dataTask = AF.request(url).decode(SomeType.self)
let response = await dataTask.response
let result = await dataTask.result
let value = try await dataTask.value

Support for other request types should follow over the coming weeks and months. If anyone has suggestions for naming for functionality, feel free to post it in this thread.

8 Likes
Terms of Service

Privacy Policy

Cookie Policy