SDWebImage checking if image cached using Swift: Ambiguous Reference
cachedImageExistsForURL
is not a class method on SDWebImageManager
, it's an instance method which you need to use on the sharedInstance
:
SDWebImageManager.sharedManager().cachedImageExistsForURL(imgURL)
As of SDWebImage
5 there is a new class, SDImageCache
, which provides a synchronous method to use:
SDImageCache.shared.diskImageDataExists(withKey: urlString)
There is also an asynchronous method with a completion handler:
SDImageCache.shared.diskImageExists(withKey: urlString) { exists in
// your code here
}