Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cursor move to the trailing of the masked text. #4

Open
brahim-lmr opened this issue Aug 11, 2023 · 0 comments
Open

Cursor move to the trailing of the masked text. #4

brahim-lmr opened this issue Aug 11, 2023 · 0 comments

Comments

@brahim-lmr
Copy link

Hello 👋🏼

I tried to use Veil to format credit card numbers of 16 digits within a text field. I'm using the pattern of "#### #### #### ####".

func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
     
      let numberMask = Veil(pattern: "#### #### #### ####")
           
      textField.text = numberMask.mask(input: cardNumber, exhaustive: false)

}

The formatting works fine, but when I tried to move the cursor in the middle of the text and delete a number, the cursor move automatically to the last number. (see the video attached)

In my opinion, the cursor should stay at the same place where the deletion happened.

Thank you.

mask_issue.mov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant