我是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)
}
}
}
所以我的问题是,如何返回此函数创建的路径?