Uh oh!
There was an error while loading. Please reload this page.
Feature/async support - #31
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| // let taskId = UUID().uuidString | ||
| // let task = Session.shared.session.dataTask(with: urlRequest) | ||
| // TODO: Should async support Session.shared.taskInProgress cancellation logic? |
There was a problem hiding this comment.
@Rashidium burada şu kodu kullanamaz mıyız abi?
private func requestData(_ urlRequest: URLRequest) async -> (URLResponse?, Data?, Error?) {
let taskId = UUID().uuidString
var task: URLSessionDataTask!
return await withCheckedContinuation { continuation in
task = Session.shared.session.dataTask(with: urlRequest) { data, response, error in
if let error = error {
Session.shared.networkLogMonitoringDelegate?.logTask(task: task, didCompleteWithError: error)
Session.shared.tasksInProgress.removeValue(forKey: taskId)
continuation.resume(returning: (response, data, error))
return
}
if let data, let response {
Session.shared.networkLogMonitoringDelegate?.logDataTask(dataTask: task, didReceive: data)
Session.shared.networkLogMonitoringDelegate?.logTask(task: task, didCompleteWithError: nil)
Session.shared.tasksInProgress.removeValue(forKey: taskId)
self.printResponse(data)
continuation.resume(returning: (response, data, nil))
}
}
Session.shared.tasksInProgress[taskId] = task
Session.shared.networkLogMonitoringDelegate?.logTaskCreated(task: task)
task.resume()
}
}
kendim ufak bir uygulama yaptım. Pulse ile dinleyebiliyorum şuan network u
There was a problem hiding this comment.
yapılabilir Eser ama with checked continuation tam olarak async desteği getiriyor mu emin değilim. http://github.com/mobven/binbin-ios 'taki networkü incelemeni tavsiye ederim. eğer test'lerimizi geçerse ordaki yapıyı yeni altyapımız yapacağız.
No description provided.