Giter VIP home page Giter VIP logo

Comments (4)

taflanidi avatar taflanidi commented on September 28, 2024

Hey @AlexisQapa, thanks for your question.

I'm on a short vacation right now, unfortunately.
I'll be able to add UITextView support early next week. I suppose this new module to be quite similar to the current UITextFieldDelegate implementation in our library, so it shouldn't take long.

Stay tuned for upcoming updates!

from input-mask-ios.

AlexisQapa avatar AlexisQapa commented on September 28, 2024

I've been playing a bit with it and I got it working. It's mostly changing methods signatures except for two things that will need discussion :

  • there is no clear button so : textViewShouldClear(_ textView: UITextView) -> Bool is useless. Maybe you could keep it somehow so if one add a clear button he can get the same behaviour.

  • the done button input a newline instead of delegating keyboard dismissal. You could add a toggle with something like :
    open func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { // Hack to detect enter key if toggle { let resultRange = text.rangeOfCharacter(from: .newlines, options: .backwards) if text.count == 1 && resultRange?.lowerBound != nil { textView.resignFirstResponder() return false } } ...
    in order to have the same behaviour as for the TextField but keep it optin as it's mostly a hack and ppl may want to input newLines.

Finally, you may want to have only one delegate class, so maybe a wrapper or the listener could implement UITextFieldDelegate and UITextViewDelegate

from input-mask-ios.

taflanidi avatar taflanidi commented on September 28, 2024

@AlexisQapa, thanks for your comments, you pretty much described the final solution.

Future UITextFieldDelegate and UITextViewDelegate objects are expected to contain lots of common logic, which brings us to the obvious need of refactoring. Repetitive code is not an option.

Though we've got a minor backward compatibility issue, as our current library listener is called a MaskedTextFieldDelegate, and I've got to retain this TextFieldDelegate naming in order to avoid breaking things. Thus, I'll need to consider a gradual refactoring or something. Nevertheless, there's nothing to be concerned about. Will see next week.

from input-mask-ios.

taflanidi avatar taflanidi commented on September 28, 2024

Implemented in 3.5.0.

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.