How to make outlet collection of views and change their corner rounded at once?

152 Views Asked by At

i have 10 views and want to make their corner rounded at once by making a outlet collections of views. i dont want to do them one by one there must be a shortcut to do that help me with the code

1

There are 1 best solutions below

0
PGDev On

You can simply call forEach(_:) on the IBOutet Collection and change each view's cornerRadius like so,

views.forEach({ $0.layer.cornerRadius = 5.0 })

Set the value of cornerRadius as per your requirement.