I'm trying to troubleshoot my app, and I think my images are being saved properly to the directory, but I don't know how to view the directory to confirm. I just need to print the file list to the console. How can I do that using Swift 4?
Asked
Active
Viewed 151 times
1 Answers
0
it print all file in document Directory
let documentDirectory = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
if let allItems = try? FileManager.default.contentsOfDirectory(atPath: documentDirectory) {
print(allItems)
}
you may copy path and open in finder as well.

junaidsidhu
- 3,539
- 1
- 27
- 49
-
I got it to print out `/var/mobile/Containers/Data/Application/54896CC4-D6AB-49E3-BF83-35ABABDE4B6F/Documents/` but that isn't working when I try to go there in Finder. I have to run on device as it involves the camera, so not sure if that is part of the issue as I assume that path is on my iPhone and not on my iMac. – DJFriar Jul 05 '18 at 06:59
-