Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let imgURL = URL(string: "https://ichef.bbci.co.uk/news/976/cpsprodpb/27C9/production/_103158101_tha.jpg")!
- func downloadImage (with url : URL){
- URLSession.shared.dataTask(with: url) { [unowned self] (data, response, error) in
- if let error = error {
- print(error.localizedDescription)
- return
- }
- DispatchQueue.main.async {
- self.imageView.image = UIImage(data: data!)
- }
- }.resume()
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement