Skip to content

Instantly share code, notes, and snippets.

@laevandus
Created December 16, 2018 10:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save laevandus/c28781a1f6659caa4dedd02d0c2b2ef4 to your computer and use it in GitHub Desktop.
Save laevandus/c28781a1f6659caa4dedd02d0c2b2ef4 to your computer and use it in GitHub Desktop.
private func loadThumbnailImage() {
let size = imageView.bounds.size
let scale = traitCollection.displayScale
let url = Bundle.main.url(forResource: "Wallpaper", withExtension: "jpg")!
DispatchQueue.global(qos: .userInitiated).async {
let image = UIImage(thumbnailOfURL: url, size: size, scale: scale)!
DispatchQueue.main.async { [weak self] in
self?.imageView.image = image
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment