I’ve always wanted to do something like
class URLSessionDataTask_Plus: URLSessionDataTask {
var obs: NSKeyValueObservation? = nil
// store the progress observer there
}
which would be very convenient. I don’t know how to do it. If instead you do something like
///URLSessionDataTask, plus more!
class URLSessionDataTask_Plus {
var task: URLSessionDataTask? = nil
var obs: NSKeyValueObservation? = nil
}
there’s really no advantage, as you anyway have to still maintain that variable externally (or maintain that whole object externally).
Progress observations are a real nuisance to hang on to as you never know how many you’ll need or where.
Is there some way to achieve this concept? ->
class URLSessionDataTask_Plus: URLSessionDataTask {
var obs: NSKeyValueObservation? = nil
// store the progress observer there
}
(I note that the same applies even if you use the futuristic async calls .. /a/78804162/294884 )
Recognized by Mobile Development Collective