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
######################### | |
# .gitignore file for Xcode4 / OS X Source projects | |
# | |
# Version 2.0 | |
# For latest version, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects | |
# | |
# 2013 updates: | |
# - fixed the broken "save personal Schemes" | |
# | |
# NB: if you are storing "built" products, this WILL NOT WORK, |
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
[self.textField.rac_textSignal subscribeNext:^(NSString *value) { | |
NSLog(@"Text field has been updated: %@", value); | |
}]; |
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
[[self.textField.rac_textSignal filter:^BOOL(NSString *value) { | |
return [value length] >= 3; | |
}] subscribeNext:^(NSString *value) { | |
NSLog(@"Text field has been updated: %@", value); | |
}]; |
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 | |
combineLatest:@[self.firstNameField.rac_textSignal, self.lastNameField.rac_textSignal] | |
reduce:^(NSString *firstName, NSString *lastName){ | |
return @(firstName.length > 0 && lastName.length > 0); | |
}] toProperty:@"enabled" onObject:self.button]; |
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
RAC(self.textField.text) = [[[RACSignal interval:1] startWith:[NSDate date]] map:^id(NSDate *value) { | |
NSDateComponents *dateComponents = [[NSCalendar currentCalendar] components:NSMinuteCalendarUnit | NSSecondCalendarUnit fromDate:value]; | |
return [NSString stringWithFormat:@"%d:%02d", dateComponents.minute, dateComponents.second]; | |
}]; |
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; |
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 *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) { |
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
RAC(self.submitButton.enabled) = [RACSignal combineLatest:@[self.usernameField.rac_textSignal, self.passwordField.rac_textSignal] reduce:^id(NSString *userName, NSString *password) { | |
return @(userName.length >= 6 && password.length >= 6); | |
}]; |
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
self.gestureRecognizerIsRunningSubject = [RACSubject subject]; | |
self.gestureRecognizerValueSubject = [RACSubject subject]; | |
RAC(self.someView.frame) = [self.gestureRecognizerValueSubject map:^id(NSValue *value) { | |
CGPoint location = [value CGPointValue]; | |
CGFloat size = 100.0f; | |
return [NSValue valueWithCGRect:CGRectMake(location.x - size/2.0f, location.y - size/2.0f, size, size)]; | |
}]; |
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
-(void)gestureRecognizerReceivedTouch:(UIPanGestureRecognizer *)recognizer { | |
if (recognizer.state == UIGestureRecognizerStateBegan) { | |
[self.gestureRecognizerIsRunningSubject sendNext:@(YES)]; | |
} | |
else if (recognizer.state == UIGestureRecognizerStateChanged) { | |
[self.gestureRecognizerValueSubject sendNext:[NSValue valueWithCGPoint:[recognizer locationInView:self.view]]]; | |
} | |
else if (recognizer.state == UIGestureRecognizerStateEnded) { |