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

Fix for autocorrect change not sent to UITextField.rText, .rAttributedText #13

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

creister
Copy link

@creister creister commented Jul 8, 2016

UITextField does not send UIControlEvents.EditingChanged when accepting an autocorrect change.
To work around this, I've observed UIControlEvents.AllEditingEvents and only sending value to rText/rAttributedText when the value has changed.
Other reactive frameworks have had this issue too, see ReactiveX/RxSwift@8a15b92

Colin Reisterer added 2 commits July 8, 2016 09:43
@creister
Copy link
Author

creister commented Jul 8, 2016

note that UITextView.rText has a similar issue. See https://github.com/ReactiveX/RxSwift/pull/371/files

unwrappedSelf.rText.value = unwrappedSelf.text
updatingFromSelf = false
// only send to rText if value changed, as .AllEditingEvents reports more than just changes
if unwrappedSelf.rText.value != unwrappedSelf.text {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any way to avoid this? I don't like the idea of performing string comparison O(n) on each keystroke...

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

Successfully merging this pull request may close these issues.

2 participants