Last active
December 17, 2015 14:08
-
-
Save ashfurrow/5621801 to your computer and use it in GitHub Desktop.
ReactiveCocoa Splitting Example
This file contains hidden or 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 *dateComponentsSignal = [[[RACSignal interval:1] startWith:[NSDate date]] map:^id(NSDate *value) { | |
NSDateComponents *dateComponents = [[NSCalendar currentCalendar] components:NSMinuteCalendarUnit | NSSecondCalendarUnit fromDate:value]; | |
return dateComponents; | |
}]; | |
RAC(self.minuteTextField.text) = [dateComponentsSignal map:^id(NSDateComponents *dateComponents) { | |
return [NSString stringWithFormat:@"%d", dateComponents.minute]; | |
}]; | |
RAC(self.secondTextField.text) = [dateComponentsSignal map:^id(NSDateComponents *dateComponents) { | |
return [NSString stringWithFormat:@"%d", dateComponents.second]; | |
}]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment