Created
July 26, 2016 00:47
-
-
Save iksnae/087db8cfcd865243b26e39299384becb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UIImageView { | |
public func cachedImage(withURL url_string:String){ | |
if let cached = ImageCache.shared.getImage(key: url_string) { | |
self.image = cached | |
}else{ | |
guard let url = NSURL(string: url_string) else { return } | |
ImageCache.shared.fetchImage(url: url, callback: { (image) in | |
NSOperationQueue.main().addOperation({ | |
self.image = image | |
}) | |
}) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment