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

Getting: fatal error: can not increment endIndex #4

Closed
t2 opened this issue Sep 8, 2015 · 8 comments
Closed

Getting: fatal error: can not increment endIndex #4

t2 opened this issue Sep 8, 2015 · 8 comments

Comments

@t2
Copy link

t2 commented Sep 8, 2015

I am getting the error: fatal error: can not increment endIndex when I move out of a masked field into an unmasked field. The culprit is in the convertRange method.

public func convertRange(range: Range<Int>) -> Range<String.Index> {

    let startIndex = advance(self.startIndex, range.startIndex)
    let endIndex = advance(startIndex, range.endIndex - range.startIndex)

    return Range<String.Index>(start: startIndex, end: endIndex)
}

My text field is basic:

phoneContactField.placeholder = "Enter your phone number"
phoneContactField.textAlignment = .Center
phoneContactField.font = UIFont.caFontWithSize(18)
phoneContactField.delegate = self
phoneContactField.mask = "({ddd}) {ddd}-{dddd}"
phoneContactField.maskDelegate = self
phoneContactField.maskTemplate = "(XXX) XXX-XXXX"
phoneContactField.maskShowTemplate = true

Any thoughts?

@artemkrachulov
Copy link
Owner

I see problem. Will fix today.

@t2
Copy link
Author

t2 commented Sep 10, 2015

@artemkrachulov Thanks! Let me know an I can test.

@artemkrachulov
Copy link
Owner

Now must work, but I will make new update tomorrow.

@t2
Copy link
Author

t2 commented Sep 16, 2015

@artemkrachulov Wasn't clear on your last comment. Are you saying that master has the fix?

@artemkrachulov
Copy link
Owner

Yes, please test )

@t2
Copy link
Author

t2 commented Sep 18, 2015

@artemkrachulov Works great once I updated to latest Swift syntax! Thanks!

@t2 t2 closed this as completed Sep 18, 2015
@loplopLover
Copy link

Hi Artem,
How can I fix that bug in Swift 1.2?
Thanks

@artemkrachulov
Copy link
Owner

Can you send your field setup?

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

3 participants