I am using kingfisher for downloading a single image with one of these methods
KingfisherManager.shared.retrieveImage
or
ImageDownloader.default.downloadImage
My question is how can I cancel the current download so I can start another one?
I don't have an ImageView so I can't use
imageView.kf.cancelDownloadTask()
Both of those methods return a task object, RetrieveImageTask
and RetrieveImageDownloadTask
respectively. You'll need to keep the task object thats returned and call task.cancel()
when you want it to cancel.