Post

Replies

Boosts

Views

Activity

Read image names from a Resource folder
I have an ios playground that has several images in the Resources folder. All the images have "png" extensions. To read all the names into an array, I was using something like this in a regular ios project that had the images in the Assets folder :import UIKit var minions = [String]() let fm = FileManager.default let path = Bundle.main.resourcePath let items = try! fm.contentsOfDirectory(atPath: path) minions = items.filter{$0.hasSuffix("png")} print(minions)That worked great in the ios project, but I can't figure out the magic formula to read the image names in a playground. I'm sure it's something simple but I can't find the answer to save my life! Help!
3
0
7.0k
Sep ’16