-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
RACChannel on UITextView.text works only in one direction #939
Comments
That's because The |
Thanks for your answer. Even though there currently is no channel defined in the category, the question is whether one could be implemented. My knowledge of ReactiveCocoa is not thorough enough to have more than some uneducated ideas about this, but since the direction into the textview works and there is a signal for updates from the textview, shouldn't it be possible to implement the other direction and provide a complete channel? |
Yep it should be very easy. The reason I asked if you needed it is that you can bind to a KVO property without one: RACChannel *modelChannel = RACChannelTo(model, someTextProperty);
RAC(textView, text) = modelChannel.followingTerminal;
[textView.rac_textSignal subscribe:modelChannel.followingTerminal]; |
Thanks, that works with one change. The first line is wrong as RACChannelTo returns a RACChannelTerminal. So it has to be changed to
That works, but is ways uglier than the magic that happens with two RACChannelTos |
Sorry my bad. RACChannelTerminal *modelTerminal = RACChannelTo(model, someTextProperty);
RAC(textView, text) = modelTerminal;
[textView.rac_textSignal subscribe:modelTerminal]; |
Thanks, that looks better. |
I'll open a new one for that. Feel free to close this one if you don't have any follow up questions. |
For some reason this isn't really working for me. I cannot see the values that |
In RACChannelTo(textView, text) = RACChannelTo(model, someTextProperty)
textView gets its text property set to someTextProperty, but editing the text in the UITextView doesn't result in someTextProperty being updated accordingly.
The text was updated successfully, but these errors were encountered: