Skip to content

Instantly share code, notes, and snippets.

@almaleh
Last active January 26, 2020 14:18
Show Gist options
  • Select an option

  • Save almaleh/cdc1cc06aa52a19fe23abe7e1c6ab4f5 to your computer and use it in GitHub Desktop.

Select an option

Save almaleh/cdc1cc06aa52a19fe23abe7e1c6ab4f5 to your computer and use it in GitHub Desktop.
let imageProcessingQueue = DispatchQueue(label: "com.besher.image-processing")
func processImageAsync(data: Data, completion: @escaping (UIImage?) -> Void) {
guard let image = UIImage(data: data) else {
completion(nil)
return
}
imageProcessingQueue.async {
let processedImage = self.upscaleAndFilter(image: image)
completion(processedImage)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment