Skip to content

Instantly share code, notes, and snippets.

@rickwierenga
Created July 28, 2019 11:42
Show Gist options
  • Save rickwierenga/ceb2a05f1991b63d8a0cce48abd7eb7a to your computer and use it in GitHub Desktop.
Save rickwierenga/ceb2a05f1991b63d8a0cce48abd7eb7a to your computer and use it in GitHub Desktop.
view.subviews.compactMap({ $0 as? UITextField }).forEach { textfield in
if let text = textfield.text, text.isEmpty {
textfield.backgroundColor = .yellow // highlight
} else {
textfield.backgroundColor = .white // default
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment