Bright Future Bright Future - 1 year ago 72
iOS Question

How to set IBOutlet collection's property in batch?

I created an IBOutlet collection of 4 buttons named

, I need to set the properties of every button like this:

button.layer.borderWidth = 1
button.layer.borderColor = UIColor.white.cgColor
button.layer.cornerRadius = 10

is an array of UIButtons, I can set the properties one by one, but that'll result in huge amount of code, especially when the buttons gets more, is there a way to set them all at a time?

Answer Source
for button in buttonCollection {
   //do something on button
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download