Last active
May 31, 2021 23:26
-
-
Save gngrwzrd/d909748b2c3af04fbdc0d1b89d259982 to your computer and use it in GitHub Desktop.
iOS Find All Inputs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private func allInputs(view:UIView) -> [UIView] { | |
var inputs:[UIView] = [] | |
for view in view.subviews { | |
if view is UITextField || view is UITextView { | |
inputs.append(view) | |
} | |
let subInputs = _allInputs(view: view) | |
if subInputs.count > 0 { | |
inputs.append(contentsOf: subInputs) | |
} | |
} | |
return inputs | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment