1. Monitor changes in UI variables
Return and pass the value down.
1.1. Output
[Self.usernameTextField.rac_textSignal subscribenext:^ (ID x) { NSLog (@ "%@", x);}];
1.2, filter, output
[[Self.usernameTextField.rac_textSignal Filter:^bool (nsstring*text) { return text.length > 3; }] subscribenext:^ (id x) { NSLog (@ "%@", x); }];
1.3, change the data type, filter-and output
[[[Self.usernameTextField.rac_textSignal Map:^id (nsstring*text) { return @ (text.length); }] Filter:^bool (nsnumber*length) { return[length integervalue] > 3; }] subscribenext:^ (id x) { NSLog (@ "%@", x); }];
1.4. Another way to Subscribenext
The RAC macro allows the output of the signal to be applied directly to the properties of the object. The RAC macro has two parameters, the first is the object that needs to set the property value, and the second is the property name. Each time a signal generates a next event, the passed value is applied to the attribute.
RAC (Self.passwordtextfield, backgroundcolor) = [validpasswordsignal map:^id (NSNumber *passwordvalid) { return[passwordvalid Boolvalue]? [Uicolor Clearcolor]:[uicolor Yellowcolor]; }];
Reactivecocoa Study notes--usage