saoudrizwan / Disk

Delightful framework for iOS to easily persist structs, images, and data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

There is no way of retrieving all images in a folder and get their filename

EthanSK opened this issue · comments

I can't seem to figure out how to get a dictionary of [String: UIImage] from a folder. I would assume this is a basic necessity, as you would need to be able to determine what images you actually saved!

Can someone tell me how to do this if I am missing it, or if it doesn't exist - can this be a feature request!

Perhaps something like this will help you:

// Create a FileManager instance

let fileManager = NSFileManager.defaultManager()

// Get contents in directory: '.' (current one)

do {
    let files = try fileManager.contentsOfDirectoryAtPath(".")
    print(files)
}
catch let error as NSError {
    print("Ooops! Something went wrong: \(error)")
}

Copied from https://iswift.org/cookbook/get-directory-contents