I am new to xCode. I want to create an array of UIImage from the folder in Assets Catalogue - see screenshot ("Brands" folder).
To load it in a UITableView like this:
private func loadLocalBrands() {
// Load images names from assets and add them to array
let names : [String] = ["Avon","Dove","Faberlic","Grand","GreenLight","Loreal",
"Loreal", "MaxFactor", "Nivea", "Olay", "Oriflame",
"Rexona","Schwarzkopf","Spaquatoria","Wella"]
for name in names{
brands.append(Brand.init(name: name, photo:
UIImage(named: name), rating: Int(arc4random_uniform(5) + 1))!)
}
}
and it works properly - see screenshot
But if I will add sooner more images, I will need to expand "names" array too.
So I want to get list of files that located in "Brands" folder within the Assets catalogue.