Last active
January 18, 2023 12:27
-
-
Save kristofk/8db00997da12a705a53a02267a0a9306 to your computer and use it in GitHub Desktop.
Custom reimplementation of textField(_:shouldChangeCharactersIn:replacamentString:)
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
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { | |
let currentText = textField.text! as NSString | |
let newText = currentText.replacingCharacters(in: range, with: string) | |
textField.text = newText | |
return false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Kristof,
I have already figured it out) It’s interesting case. Thanks for replying