Open
Description
Motivation
When changing to use async await functions from URLSession I noticed that we lost access to URLSessionDataTask which is necessary when we need to cancel a request. And we need this kind of function especially when working with Feed screens and things alike.
Solution
We already can create an URLSessionDataTask but we don't have an async await function to perform it so my solution would be to add a function that performs URLSessionDataTask and the result would be the same (Data, Response) tulple
extension URLSession {
func perform(dataTask: URLSessionDataTask) async -> (Data, Response)
}
Alternatives considered
Another solution would be to add this perform
async await function at the URLSessionDataTask as the resume function that it already has but in this case, would be an async await function
extension URLSessionDataTask {
func resume() async -> (Data, Response)
}