Reputation: 143
I have some image sets located in Assets.xcassets folder/library, as shown in the screenshot below. All what i want is to add those images to an array so i can use it later on to populate a CollectionView cells. How can i insert those images into an array?
For example, the array should include [airplace.jpg, cars.jpg, ship.jpg]
Upvotes: 1
Views: 2158
Reputation: 534950
Well, the way you retrieve an image from the asset catalog is with UIImage(named:)
. So... How about:
let theArray = [UIImage(named:"airplane")!,
UIImage(named:"cars")!,
UIImage(named:"ship")!]
Upvotes: 1