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

Get original string #21

Closed
beltik opened this issue Sep 27, 2017 · 6 comments
Closed

Get original string #21

beltik opened this issue Sep 27, 2017 · 6 comments
Assignees
Labels

Comments

@beltik
Copy link

beltik commented Sep 27, 2017

How to get original string?
For example, i have mask {(123)}-[000] and text field text is "(123)456, i want to get what exactly user enter, is that case - 456.

@taflanidi taflanidi self-assigned this Sep 27, 2017
@taflanidi
Copy link
Collaborator

taflanidi commented Sep 27, 2017

Hey @beltik
Thanks for your question.

MaskedTextFieldDelegate has a listener with a callback method textField(_:didFillMandatoryCharacters:didExtractValue:), where the «extracted value» is a variable you seek, see the Usage section for the implementation details.

@beltik
Copy link
Author

beltik commented Sep 27, 2017

Thanks.
I also want to feature to add any character or digit or symbol to user input.
Currently for do that, i drag library to my object and modified.
Reason is, i needed symbols like ".%@?" etc.

@taflanidi
Copy link
Collaborator

taflanidi commented Sep 27, 2017

@beltik,

I'm not sure I've understood you right, but there's a feature request about special characters, and the current work is in progress.

P.s. Also, according to your mask format, for {(123)}-[000] you will receive a resulting value like (123)000, with (123) prefix included.

In order to omit it, you should incorporate a format like (123)-[000].

@beltik
Copy link
Author

beltik commented Sep 27, 2017

@taflanidi

If i have mask like [-] or [_] i can only enter letters or numbers, but what about symbols like dot? Currently i can't type dot and other symbols in field.

To add that ability i did drag library from pods to project and modify it. There is a method that returns only specific character set depend on enum case, i simply comment it and return YES (because it suite to my needs). But better solution is to add something like ["specific-key"] that allow to edit all symbols.

@beltik
Copy link
Author

beltik commented Oct 5, 2017

Let me try to explain again. I need ability to add symbols like "," or ".".
For do that, i copied library to my project, and in class ValueState in func func accepts(character char: Character) -> Bool {
I replaced code with following:
case .AlphaNumeric:
// return CharacterSet.alphanumerics.isMember(character: char)
return true

But, of course i would preffer adding additional case, like case .everyCharacter. And that feature i request for (or maybe there is an simplier way but i did not found it).
Hope i make myself clear.

@taflanidi
Copy link
Collaborator

Implemented in 3.3.0.

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

No branches or pull requests

2 participants