Skip to content

Instantly share code, notes, and snippets.

@imbradbrown
Created July 13, 2017 20:17
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save imbradbrown/4307f9777482ff8e80a511dbecc6df43 to your computer and use it in GitHub Desktop.
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