Created
May 21, 2013 17:51
-
-
Save ashfurrow/5621791 to your computer and use it in GitHub Desktop.
ReactiveCocoa Chaining Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RACSignal *intervalSignal = [RACSignal interval:1]; | |
RACSignal *startedIntervalSignal = [intervalSignal startWith:[NSDate date]]; | |
RACSignal *mappedIntervalSignal = [startedIntervalSignal map:^id(NSDate *value) { | |
NSDateComponents *dateComponents = [[NSCalendar currentCalendar] components:NSMinuteCalendarUnit | NSSecondCalendarUnit fromDate:value]; | |
return [NSString stringWithFormat:@"%d:%02d", dateComponents.minute, dateComponents.second]; | |
}]; | |
RAC(self.textField.text) = mappedIntervalSignal; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment