Created
June 9, 2017 02:26
-
-
Save helloworldsmart/0379fb9968ed44a5eb2fe6b518c1c604 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| func withBigImage(completionHandler handler: @escaping (_ image: UIImage) -> Void) { | |
| DispatchQueue.global(qos: .userInitiated).async { () -> Void in | |
| if let url = URL(string: BigImages.whale.rawValue), | |
| let imgData = try? Data(contentsOf: url), | |
| let img = UIImage(data: imgData) { | |
| DispatchQueue.main.async(execute: { () -> Void in | |
| handler(img) | |
| }) | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment