Created
July 4, 2025 11:34
-
-
Save jacobsapps/eea671cb6ea786c4ae2278e31bb80d8d 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 { | |
| func resized(to width: CGFloat) -> UIImage { | |
| let ratio = size.height / size.width | |
| let size = CGSize(width: width, height: width * ratio) | |
| let renderer = UIGraphicsImageRenderer(size: size) | |
| return renderer.image { _ 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