Sydney Loteria Sydney Loteria - 2 years ago 366
Swift Question

Get SDWebImage Cache Image

I would like to ask on how to get the downloaded image after the SDWebImageManager downloaded it. I have only the code to download it via URL, here's what I got:

let manager: SDWebImageManager = SDWebImageManager.sharedManager()
manager.downloadImageWithURL(NSURL(string: feedDetails.thumbnail), options: [],
progress: {(receivedSize: Int, expectedSize: Int) -> Void in
completed: {(image, error, cached, finished, url) -> Void in

self.feedImage.image = image

Answer Source

From the SDWebImageManager class the downloadImageWithURL: method

Downloads the image at the given URL if not present in cache or return the cached version otherwise.

So if the image is present in cache you are already retrieving it with your code, instead of downloading from the web.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download