Post

Replies

Boosts

Views

Activity

Comment on Is there an order for response, data, and error in URLSession delegates?
I currently have it as below, so that the completionHandler gets called first and no matter what ` func urlSession(_ session: URLSession, dataTask: URLSessionDataTask, didReceive response: URLResponse, completionHandler: (URLSession.ResponseDisposition) -> Void) { completionHandler(URLSession.ResponseDisposition.allow) if let httpResponse = response as? HTTPURLResponse { xFile?.httpResponse = httpResponse.statusCode DispatchQueue.main.async { [self] in if httpResponse.statusCode != 200 { ...my code } } } }`
Topic: Programming Languages SubTopic: Swift Tags:
May ’22