we are struggling to cancel request that already sent when we use collection view cell .. ( i am not talking about cases when we want to cancel request because we already sent the same request) ... i guess we need to use the methods: cancelRequestForRequestReceipt .. the problem is that it's not clear how to get this RequestReceipt.
Example:
We have a collection view with different images (each image have a different url) .. if i will scroll back and forward fast , the method af_cancelImageRequest will do the job and will not create 2 active request for the same url.. Super!, the problem is when we try to scroll only to 1 direction and we have 1000 images .. basically we want to be able to cancel the request that just sent, before the image will return, meaning we don't have the image and we don't AlamofireImage to continue with that request ... after the cell is disappear (cause by slow internet and fest scrolling ).. So, if i got it right , we can use cancelRequestForRequestReceipt ... the problem is that we can't find how to get this RequestReceipt ...
BTW: i saw the example code that AlamofireImage demo app,
override func prepareForReuse() {
super.prepareForReuse()
imageView.af_cancelImageRequest()
imageView.layer.removeAllAnimations()
imageView.image = nil
}
As i said, this code will cancel request for images ONLY if the request is already in the operation queue ..
Help :)