Create a gist now

Instantly share code, notes, and snippets.

UIImageJPEGRepresentation wrapped within an Autorelease Pool
func UIImageToDataJPEG2(image: UIImage, compressionRatio: CGFloat) -> Data? {
return autoreleasepool(invoking: { () -> Data? in
return UIImageJPEGRepresentation(image, compressionRatio)
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment