Skip to content

Instantly share code, notes, and snippets.

@bennagar
Created February 15, 2017 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bennagar/1d9c4114f49a712ac0e4bfd178fdcf52 to your computer and use it in GitHub Desktop.
Save bennagar/1d9c4114f49a712ac0e4bfd178fdcf52 to your computer and use it in GitHub Desktop.
Save to document directory - so it can be read from iTunes
/** Add to plist
'UIFileSharingEnabled' = YES
'Bundle display name' = $(PRODUCT_NAME)
*/
var filePath:URL? = {
return FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first?.appendingPathComponent("file.txt")
}()
"TEST".write(to: filePath, atomically: true, encoding: .UTF8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment