Skip to content

Instantly share code, notes, and snippets.

@gngrwzrd
Last active May 31, 2021 23:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gngrwzrd/d909748b2c3af04fbdc0d1b89d259982 to your computer and use it in GitHub Desktop.
Save gngrwzrd/d909748b2c3af04fbdc0d1b89d259982 to your computer and use it in GitHub Desktop.
iOS Find All Inputs
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