Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. let imgURL = URL(string: "https://ichef.bbci.co.uk/news/976/cpsprodpb/27C9/production/_103158101_tha.jpg")!
  2.  
  3. func downloadImage (with url : URL){
  4. URLSession.shared.dataTask(with: url) { [unowned self] (data, response, error) in
  5. if let error = error {
  6. print(error.localizedDescription)
  7. return
  8. }
  9. DispatchQueue.main.async {
  10. self.imageView.image = UIImage(data: data!)
  11. }
  12.  
  13. }.resume()
  14.  
  15.  
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement