I\'m having some trouble with converting Objective-C code to create a directory for Swift.
Objective-C:
NSArray *paths = NSSearchPathForDirectori
"~/Desktop/demo".expand.createDir()//Now you have a folder named demo on your desk
extension String{
func createDir(_ path:String){
do {
try FileManager.default.createDirectory(atPath: path, withIntermediateDirectories: true, attributes: nil)
} catch let error as NSError {
NSLog("Unable to create directory \(error.debugDescription)")
}
}
var expand:String {return NSString(string: self).expandingTildeInPath}
}