jobandtalent / AnimatedTextInput

Animated UITextField and UITextView replacement for iOS
MIT License
760 stars 128 forks source link

how to do i enable autocorrection? #67

Closed ghost closed 7 years ago

ghost commented 7 years ago

how to do i enable autocorrection?

victorBaro commented 7 years ago

It would be a nice addition. Currently it is a bit tricky. Long story short: AnimatedTextInput is a simple view that either contains a UITextView or UITextField (they implement TextInput protocol) , depending on which type you need. Each type defines its own configurator, that basically generates a textInput (so again, either textview or textfield). This generated textInput is already set up (things like keyboardType, autocorrection, etc). We also provide a type generic that accepts your own textInput.

So, in order to create your own textInput I'd suggest:

  1. Create your own TextInput. I'd suggest you use the provided ones, either AnimatedTextField or AnimatedTextView. Something like:

        let myInput = AnimatedTextField()
        myInput.clearButtonMode = .whileEditing
        myInput.keyboardType = .emailAddress
        myInput.autocorrectionType = .yes
  2. Provide your textInput to the animatedTextInput as generic type like so:

        animatedTextInput.type = .generic(textInput: myInput)

Side note: Should you use AnimatedTextField or AnimatedTextView? Depends on your needs. For instance, textfields do not support multiline. Text views do not support secure text entry (for passwords). The class AnimatedTextInput is just a container of either of those 2 text inputs. It adds the placeholder animation and the bottom line look.

ghost commented 7 years ago

Im able to get the textview autocorrection now, but when I type the textview value does change. I know I can use textViewDidBeginEditing to update AnimatedTextInput().text but I didn't that should be necessary.

p4vlos commented 7 years ago

do you know if we can make this library available for iOS 10.0?

victorBaro commented 7 years ago

@pprevalon sorry I don't understand. What do you mean?

@p4vlos if your question is not related to this issue, feel free to open a new one. The library works with iOS10.0

sunchengbo commented 5 years ago

textAttributes How to use