reactive cocoa note

Observe textField.text changing

1
2
3
4
//only RACObserve(self.textField, text) or self.textField.rac_textSignal will not working
RACSignal *textFieldTextSignal = [RACSignal merge:@[RACObserve(self.textField, text),self.textField.rac_textSignal]];
[textFieldTextSignal subscribeNext:block];

Combine two signals

1
2
3
4
5
6
7
8
void(^block)(RACTuple *) = ^(RACTuple *tuple) {
NSString *x = tuple.first;
NSString *y = tuple.second;
//do something
};
[[RACSignal combineLatest:@[signal1,signal2]] subscribeNext:block];