I have a view which has more than 15 UITextFields. I have to set bottomBorder(extension) for all the UITextFields. I can set it one by one for all
This worked for me.
var textFieldsArray = [UITextField]()
for view in self.view.subviews {
if view is UITextField {
textFieldsArray.append(view as! UITextField)
}
}
textFieldsArray.forEach { $0.setBottomBorder() }
If you want to get the result of the function applied in a new array, use map() instead.