Create a folder

 Problem

I want to create a new directory at a specific location.



 Recipe


// Create a FileManager instance

let fileManager = NSFileManager.defaultManager()

// Create 'subfolder' directory

do {
    try fileManager.createDirectoryAtPath("subfolder", withIntermediateDirectories: true, attributes: nil)
}
catch let error as NSError {
    print("Ooops! Something went wrong: \(error)")
}
				

Heard the news?

The Swift Cookbook for Swift 3 is at last here! For iBooks, Kindle and Paperback.
Hurry up - and Check it out! ;-)

 

 Playground