Based on work by an Apple engineer (whose name I can’t remember) in the labs at WWDC, I've pushed a branch containing a few initial bits of support of Combine support for Alamofire. This includes:
-
Request, aPublisherto transformURLRequests into AlamofireDataRequests. This will eventually be enhanced with support for ourURLRequestConvertibleprotocol. -
Response, aPublisherwhich adds aresponseDecodablehandler to aDataRequestand passes along theDataResponse<T>.
This allows for easy creation and response handling using Combine and Alamofire:
// When
let urlRequest = URLRequest.makeHTTPBinRequest()
_ = Publishers.Just(urlRequest)
.request()
.response(of: HTTPBinResponse.self)
Combine also makes it trivial to wait for the results of multiple requests, so thanks to @Tony_Parker and the Foundation team for such a commonly requested feature.
Ongoing issues include the lack the cancellation support, and there could be some queue hops internally, as the Alamofire response callback is called on a custom queue.
This can be tried out on the initial-combine-support branch of Alamofire.