0

I have 3 IBOutlets, defined as:

  • imageView1
  • imageView2
  • imageView3

I would like to specify each IBOutlet within a loop.

for (index, item) in items {
    imageView + index.image = UIImage()
}

It would seem some form of string interpolation is required?

jingo_man
  • 509
  • 3
  • 13
  • 1
    let images = [imageView1, imageView2, imageView3] and then use images in for loop? – Miknash Aug 06 '19 at 15:10
  • 1
    Variables are evaluated at compile time. Any *form of string interpolation is* **not** supported. – vadian Aug 06 '19 at 15:12
  • Variables don't even exist at runtime. They're convenient memnotics created just for human understanding. They're one of the first things stripped out during compilation, just like comments. – Alexander Aug 06 '19 at 15:21
  • thanks for directing to a similar question. using the same "outlet collection" method creates an array of imageView's that I can use in the suggested loop above with imageViewCollection[index].image = ... – jingo_man Aug 06 '19 at 22:28

0 Answers0