When I\'ve tried How to you set the maximum number of characters that can be entered into a UITextField using swift?, I saw that if I use all 10 characters, I can\'t erase t
Im using this;
Limit 3 char
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { if let txt = textField.text { let currentText = txt + string if currentText.count > 3 { return false } return true } return true }