简体   繁体   中英

How to get all the files from Applications document directory in swift?

I'm new to swift language and i use this code for get document directory

let paths = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true);

it's right but when we run the project then the second cript code changed every time and my issue is that i want to store all the recorded videos to document directory and then load that all the recorded videos to my application's custom gallery to see the application's whole recorded videos but when i store that videos then it stores in different directory on every new run.

so how can i fatch and load that whole recorded videos from applications document directory

do{
    let files = try FileManager.default.contentsOfDirectory(atPath: documentsDirectory)
     for filename in files {
         print(filename)
    }
  }
     catch {
        print(error.localizedDescription)
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM