Skip to content

Instantly share code, notes, and snippets.

@J7mbo
Created August 8, 2018 14:40
Show Gist options
  • Save J7mbo/6f943805edd6d9afd5944ee3e46e8ad2 to your computer and use it in GitHub Desktop.
Save J7mbo/6f943805edd6d9afd5944ee3e46e8ad2 to your computer and use it in GitHub Desktop.
DispatchQueue.global(qos: .background).async {
let jsonDownloader: JsonDownloader = JsonDownloader()
let imageDownloader: ImageDownloader = ImageDownloader()
let json: [String: AnyObject] = jsonDownloader.downloadContentsOfUrl("ourUrl.com")
let image: UIImage = imageDownloader.downloadImage(URL(string: json["image_url"]))
DispatchQueue.main.async {
// -- SNIP -- Add image to UIImageView and add a subview in UIView
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment