Skip to content

Instantly share code, notes, and snippets.

@richimf
Created March 13, 2019 03:33
Show Gist options
  • Save richimf/0024ac452778c001beb65720e9e205fe to your computer and use it in GitHub Desktop.
Save richimf/0024ac452778c001beb65720e9e205fe to your computer and use it in GitHub Desktop.
TextFieldListenToEvents
private func setup() {
self.addTarget(self, action: #selector(beginEditing), for: UIControl.Event.editingDidBegin)
self.addTarget(self, action: #selector(textDidChange), for: UIControl.Event.editingChanged)
self.addTarget(self, action: #selector(textEndEditing), for: UIControl.Event.editingDidEnd)
}
@objc func beginEditing() {
print(#function)
}
@objc func textEndEditing() {
print(#function)
}
@objc func textDidChange() {
print(#function)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment