Last active
March 9, 2022 15:18
-
-
Save agrawalsuneet/e36e8998a0e4e313953e8cb0f4e1fb77 to your computer and use it in GitHub Desktop.
Extension to UITextField to add editing event in a clean way
This file contains hidden or 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
//MARK: - UITextField Extension | |
@available(iOS 14.0, *) | |
extension UITextField { | |
func setOnTextChangeListener(onTextChanged :@escaping () -> Void){ | |
self.addAction(UIAction(){ action in | |
onTextChanged() | |
}, for: .editingChanged) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment