I am creating a phone number formatter and to not break my background formatting logic, I want users to be able to only type numbers and delete (Number keyboard), and not move throughout the UITextfield.text
with his touch. This will also prevent the user from pasting text, which is something I want to prevent as well. So, in short, I want the user to fill the phone number and should he/she ever need to correct a single character, he/she should delete all numbers after such character to be able to delete the mistaken one.
Therefore, text should be editable but not selectable (and cursor not movable).
My guess is that it could be something inside this method.
func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool