JavaNut13 JavaNut13 - 1 year ago 139
Swift Question

Create Folder in Swift

I'm new to swift and I'm not sure how to make a new folder from a string path (or from some kind of

File/ NSFile

This is on OS X with Cocoa.

Answer Source

My understanding is that you are trying to create a directory programmatically using swift. The code given below does the same.

    var err: NSErrorPointer = nil
    let manager = NSFileManager.defaultManager()
    manager.createDirectoryAtPath("/Users/abc/Desktop/swiftDir", withIntermediateDirectories: true, attributes: nil, error: err)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download