How to create directory using Swift code (NSFileManager)

前端 未结 8 2111
一个人的身影
一个人的身影 2020-12-23 12:49

I\'m having some trouble with converting Objective-C code to create a directory for Swift.

Objective-C:

    NSArray *paths = NSSearchPathForDirectori         


        
8条回答
  •  鱼传尺愫
    2020-12-23 13:18

    For Other developers, Im gonna leave this here as it may help someone like me looking for a way to figure out where the folder is being created.

    let paths = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true) as NSArray
    let documentsDir = paths.firstObject as String
    println("Path to the Documents directory\n\(documentsDir)")
    

提交回复
热议问题