How to convert code objective c to Swift to save image?

后端 未结 5 1385
别跟我提以往
别跟我提以往 2021-01-11 18:24

I have seen this code in other post, for save pictures:

  // Create path.
 NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,      NSU         


        
5条回答
  •  孤城傲影
    2021-01-11 18:51

    Here is what I use:

        let fileManager = NSFileManager.defaultManager()
        let nsDocumentDirectory = NSSearchPathDirectory.DocumentDirectory
        let nsUserDomainMask = NSSearchPathDomainMask.UserDomainMask
        let documentsURL = fileManager.URLsForDirectory(nsDocumentDirectory, inDomains: nsUserDomainMask).last
    

提交回复
热议问题