Skip to content

Instantly share code, notes, and snippets.

@staycreativedesign
Created July 22, 2017 02:51
Show Gist options
  • Save staycreativedesign/b48d8ab919faafb28d8d85f8efb6c0b5 to your computer and use it in GitHub Desktop.
Save staycreativedesign/b48d8ab919faafb28d8d85f8efb6c0b5 to your computer and use it in GitHub Desktop.
// if directory exists skip
// else
//create directory
createDirectory(name: "cabecao/decks/comida/")
func createDirectory(name: String) {
let fm = FileManager.default
let dirPath = fm.urls(for: .documentDirectory, in: .userDomainMask)
let docsURL = dirPath[0]
let deckPath = docsURL.appendingPathComponent(name)
do {
try fm.createDirectory(at: deckPath, withIntermediateDirectories: true, attributes: nil)
}
catch {
print(error.localizedDescription)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment