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
UITextFields
extension:
extension UIView { func viewOfType(type:T.Type, process: (_ view:T) -> Void) { if let view = self as? T { process(view) } else { for subView in subviews { subView.viewOfType(type:type, process:process) } } } }
Usage:
view.viewOfType(type:UITextField.self) { view in view.text = "123" }