Skip to content

Instantly share code, notes, and snippets.

@egcode
Created April 15, 2017 03:46
Show Gist options
  • Save egcode/f262495b4fdd675f9165284c4d0fa624 to your computer and use it in GitHub Desktop.
Save egcode/f262495b4fdd675f9165284c4d0fa624 to your computer and use it in GitHub Desktop.
import UIKit
extension UIImageView {
func loadImage(url: String, completed: @escaping (_ success: Bool) -> Void) {
API.get(url: url) { (code, object) in
if let img = object as? UIImage {
self.image = img
completed(true)
} else {
completed(false)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment