Created
May 21, 2019 09:07
-
-
Save hsleedevelop/b3c7eb3540679214ce733573d94082ab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UIImage { | |
//best performance - https://nshipster.com/image-resizing/ | |
func resizedImage(size: CGSize) -> UIImage? { | |
let renderer = UIGraphicsImageRenderer(size: size) | |
return renderer.image { (context) in | |
self.draw(in: CGRect(origin: .zero, size: size)) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment