Say I have the following:
UITextField *textField = [[UITextField alloc] init];
and a model object:
JSModel *model = [[JSModel alloc] init];
The following will give me a two-way binding (perhaps there are disadvantages with this approach that I'm not seeing?):
RAC(model, text) = textField.rac_textSignal;
RAC(textField, text) = RACObserve(model, text);
How can [UITextField rac_newTextChannel]
be used to achieve this two-way binding?
Something like:
RACChannelTerminal *textFieldTerminal = [self.textField rac_newTextChannel];
RACChannelTerminal *modelTerminal = RACChannelTo(self.model, text);
[modelTerminal subscribe:textFieldTerminal];
[[textFieldTerminal skip:1] subscribe:modelTerminal];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With