Skip to content

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