Skip to content

Instantly share code, notes, and snippets.

@bobspryn
Last active August 29, 2015 14:08
Show Gist options
  • Save bobspryn/fd3b14a49582c4aa9af1 to your computer and use it in GitHub Desktop.
Save bobspryn/fd3b14a49582c4aa9af1 to your computer and use it in GitHub Desktop.
basicSubscribe.m
- (void) viewDidLoad {
// ...
// create and get a reference to the signal
RACSignal *usernameValidSignal = RACObserve(self.viewModel, isUsernameValid);
// update the local property when this value changes
[usernameValidSignal subscribeNext:^(NSNumber *isValidNumber) {
self.usernameIsValid = isValidNumber.boolValue
}];
}
@yulingtianxia
Copy link

I think you forget the "subscribeNext":

- (void) viewDidLoad {
  // ...
  // create and get a reference to the signal
  RACSignal *usernameValidSignal = RACObserve(self.viewModel, isUsernameValid);
  // update the local property when this value changes
  [usernameValidSignal subscribeNext:^(NSNumber *isValidNumber) {
          self.usernameIsValid = isValidNumber.boolValue
      }];
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment