FS.O5 FS.O5 - 1 year ago 60
Swift Question

Set an array of IBObjects

I have a xib file that has 10

s in it.

I need to change the color of a random button every second.

Is the only way is to create an individual IBOutlet to every button and then create an array in
with these button or is there any way I can create an array of all the buttons straight from
Interface Builder

Thank you!

Answer Source

Sure, you can create an IBOutletCollection instead of IBOutlets :


Then you can add buttons to this collection by drawing the + symbol to each button :

Plus button

Have fun!