Skip to content

Instantly share code, notes, and snippets.

@dklenke
Created October 9, 2018 15:08
Show Gist options
  • Save dklenke/64345cad2b853dd321d35b997dacea61 to your computer and use it in GitHub Desktop.
Save dklenke/64345cad2b853dd321d35b997dacea61 to your computer and use it in GitHub Desktop.
let fileMang = FileManager.default
var filePath = NSHomeDirectory()
do {
let appSupportDir = try FileManager.default.url(for: .applicationSupportDirectory, in: .userDomainMask, appropriateFor: nil, create: true)
filePath = appSupportDir.appendingPathComponent("points.txt").path
}
catch{}
print(filePath)
if fileMang.fileExists(atPath: filePath) {
do {
try fileMang.removeItem(atPath: filePath)
}
catch {}
}
let test = fileMang.createFile(atPath: filePath, contents: "0, 0, 0".data(using: String.Encoding.utf8), attributes: nil)
print(test)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment