Skip to content

Instantly share code, notes, and snippets.

@andrewwoz
Last active October 16, 2019 15:17
Show Gist options
  • Select an option

  • Save andrewwoz/999d7f2acc5bde820710ed6c3213042a to your computer and use it in GitHub Desktop.

Select an option

Save andrewwoz/999d7f2acc5bde820710ed6c3213042a to your computer and use it in GitHub Desktop.
[Create file] #fs
let fs = FileManager.default
let content = "Hello World"
let data = content.data(using: .utf8)
let isCreated = fs.createFile(
atPath: documents.appendingPathComponent("hello.txt").path,
contents: data, attributes: nil)
if isCreated {
// file was created
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment