Created
April 15, 2017 03:46
-
-
Save egcode/f262495b4fdd675f9165284c4d0fa624 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
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