Giter VIP home page Giter VIP logo

Comments (6)

lutchobandeira avatar lutchobandeira commented on August 18, 2024 1

I have the same use case. It would be nice to have this feature implemented in the lib.

from input-mask-ios.

taflanidi avatar taflanidi commented on August 18, 2024 1

Implemented in 3.4.0.

Use ReversedMaskTextFieldDelegate for your needs.

Unfortunately, you won't be able to use decimal format yet. I'll need some time to investigate that.

from input-mask-ios.

DamascenoRafael avatar DamascenoRafael commented on August 18, 2024

@joaolongo same here. Did you find any solution?

Using format: [90000]-[0000]
Getting: 12345-678
expected: 1234-5678

from input-mask-ios.

taflanidi avatar taflanidi commented on August 18, 2024

Hi @joaolongo and @DamascenoRafael,
Thanks for your question.

I think you should consider subclassing the MaskedTextFieldDelegateListener for your needs, overriding these methods:

open func deleteText(
    inRange range: NSRange,
    inField field: UITextField
) -> (String, Bool)

and

open func modifyText(
    inRange range: NSRange,
    inField field: UITextField,
    withText text: String
) -> (String, Bool)

You need to reverse the original text before applying the mask, and then reverse the result before assignment to the text field.

I didn't have an opportunity to try this myself, unfortunately. So, should you have any clarifying questions, please go ahead and ask them.

from input-mask-ios.

joaolongo avatar joaolongo commented on August 18, 2024

@DamascenoRafael
I did find a solution to this issue, but I had to implement a new pattern myself.
Here, try this:

https://gist.github.com/joaolongo/957a6e2826ce6edc0ad531d2f1081db3

from input-mask-ios.

taflanidi avatar taflanidi commented on August 18, 2024

Okay, I'm considering this as a feature candidate for future releases.
Please, stay tuned.

from input-mask-ios.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.