Created
July 27, 2019 09:19
-
-
Save codedeman/b84d9877533aa484fa4d9ae7d02630ea to your computer and use it in GitHub Desktop.
loadImagefromurl
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
func loadImage(urlString1:String,urlString2:String) { | |
DispatchQueue.global().async { | |
let url1 = URL(string: urlString1) | |
let url2 = URL(string: urlString2) | |
guard let data1 = try? Data(contentsOf: url1!) else {return} | |
guard let data2 = try? Data(contentsOf: url2!) else {return} | |
self.dispatchGroup.enter() | |
self.run { | |
self.imageURL1.image = UIImage(data: data1) | |
self.imageUrl2.image = UIImage(data: data2) | |
self.dispatchGroup.leave() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment