Skip to content

Instantly share code, notes, and snippets.

@kristofk
Last active January 18, 2023 12:27
Show Gist options
  • Save kristofk/8db00997da12a705a53a02267a0a9306 to your computer and use it in GitHub Desktop.
Save kristofk/8db00997da12a705a53a02267a0a9306 to your computer and use it in GitHub Desktop.
Custom reimplementation of textField(_:shouldChangeCharactersIn:replacamentString:)
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
}
@AnatoliyOstapenko
Copy link

Hi Kristof,
I have already figured it out) It’s interesting case. Thanks for replying

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment