Created
July 13, 2017 20:17
-
-
Save imbradbrown/4307f9777482ff8e80a511dbecc6df43 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
var paths = NSSearchPathForDirectoriesInDomains(.documentDirectory, .allDomainsMask, true) | |
var root = paths.first | |
if let path = root?.appending("/image.jpg") { | |
do { | |
let url = URL(fileURLWithPath: path) | |
try UIImagePNGRepresentation(image)?.write(to: url, options: Data.WritingOptions.atomicWrite) | |
} catch { | |
return | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment