Skip to content

Instantly share code, notes, and snippets.

@bobspryn
Created October 29, 2014 06:29
Show Gist options
  • Save bobspryn/a731e8026c2143eaf2e3 to your computer and use it in GitHub Desktop.
Save bobspryn/a731e8026c2143eaf2e3 to your computer and use it in GitHub Desktop.
- (void) viewDidLoad {
//...
RACSignal *usernameIsValidSignal = RACObserve(self.viewModel, isUsernameValid);
RAC(self.goButton, enabled) = usernameIsValidSignal;
RAC(self.goButton, alpha) = [usernameIsValidSignal
map:^id(NSNumber *usernameIsValid) {
return usernameIsValid.boolValue ? @1.0 : @0.5;
}];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment