This is inside my viewForHeaderInSection. That means, this happens through each section.
for i in 0..<mySections[section].items!.count {
print("Valid For \(mySections[section].items[i]).")
let imagesArray = [header.icon1, header.icon2, header.icon3, header.icon4, header.icon5]
imagesArray[i].image = UIImage(named: "IconHamburger")
}
So for each section, I get the values for "Valid For".
E.g. Section 1 gets
- Valid For ABC.
- Valid For PQR.
- Valid For XYZ.
Section 2 gets
- Valid For ABC.
- Valid For XYZ.
and so on...
My question is how do I assign image name to the images in my imagesArray? With condition like -
if Valid For is ABC, image name is "ImageAbc"
if Valid For is PQR, image name is "ImagePqr"
With my current code snippet above, all my image outlets get "IconHamburger" assigned.
Also, I have 5 images in my array and, the "Valid For" items are always <= 5. So if I get 3 "Valid For" items, images need to be assigned only for the first three images.
Current output Screenshot from a section here -