-
-
Save MemoryReload/d8bac8b2d9d9d65df3e4db0e3bdf4218 to your computer and use it in GitHub Desktop.
This file contains 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 URL { | |
func loadImage(_ image: inout UIImage) { | |
if let loaded = UIImage(contentsOfFile: self.path) { | |
image = loaded | |
} | |
} | |
func saveImage(_ image: UIImage) { | |
if let data = image.jpegData(compressionQuality: 1.0) { | |
try? data.write(to: self) | |
} | |
} | |
} | |
https://developer.apple.com/forums/thread/661144 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment