如何在Swift 3中获取创建目录的名称

时间:2017-12-10 09:40:19

标签: swift3

我是iOS新手,我创建了这个方法来创建一个目录:

 static func fileHandler () {
    let Mainpath = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
    let myPath = Mainpath + "/Images Folder "
    print (myPath)
    var Myobjbool :ObjCBool = true

    let isExist = FileManager.default.fileExists(atPath: myPath, isDirectory: &Myobjbool)

    if isExist == false{
        do {
            try FileManager.default.createDirectory(atPath: myPath, withIntermediateDirectories: true, attributes: nil)
            print (FileManager.default.currentDirectoryPath)
        }catch {
            print (error)
        }
    }

}

所以我的问题是,如何返回此函数创建的路径?

0 个答案:

没有答案