Open Codeglee opened 10 years ago
Sorry for the delay in response. I've been thinking about this too. The current implementation doesn't factor canceling in, or progress for that matter. I've got a version I haven't checked in that handles these better, but I'm not quite done.
Do you have any good strategies for handling this scenario?
I know that
NSURLSessionDataTask
has a cancel method, but I'm not sure what the best way to handle this would be.What I've done is modified your image methods to capture the request and changed them to have NSURLSessionDataTask? as the return type. In my calling code (the UICollectionViewCell) I capture the request and by checking the current request.state == .Running I know if I should abandon that request, nil it off and recreate it.
Do you have any better ideas?