James Schneider James Schneider - 6 months ago 8
Swift Question

Listing files in a specific folder

I've created a folder called "Photos" in the Documents folder.

Using Swift code, I want to print the names of the files in the Photos folder.

Answer
do {
    let files = try NSFileManager.defaultManager().contentsOfDirectoryAtPath("/Users/username/Documents/Photos")
    print(files)
} catch {
    print(error)
}