So SDWebImage Download image and store to cache for key this is exactly what I want to do in my application. I want to store the image in a key and fetch image later. This is my block of code :
SDWebImageManager.shared().imageDownloader?.downloadImage(with: URL.init(string: url), options: SDWebImageDownloaderOptions.highPriority, progress: { (receivedSize:Int,expectedSize:Int,url : URL?) in
print("progressing here in this block ")
}, completed: ({(image : UIImage, data : Data,error : Error, finished : Bool) in
print("reached in the completion block ")
if finished {
SDImageCache.shared().store(image, forKey: "d", toDisk: true, completion: nil)
} else {
print(error.localizedDescription)
showAlert(viewController: self, title: "", message: error.localizedDescription)
}
} as? SDWebImageDownloaderCompletedBlock))
However, the completion block is never called.