So I have a UIBarButtonItem in my navigation bar and want to use RAC() like this:

RAC(myButton, enabled) = [RACSignal 
  combineLatest:@[ RACObserve(self, password), RACObserve(self, passwordConfirmation) ] 
  reduce:^(NSString *password, NSString *passwordConfirm) {
    return @([passwordConfirm isEqualToString:password]);
  }];

But also rac_command to catch when tapped, like this:

myButton.rac_command = [[RACCommand alloc] initWithSignalBlock:^RACSignal *(id input) {
  // Do stuff
  return [RACSignal empty];
}];

When I combine those two, I get an assertion error.

So the question is: How can I use RAC() and rac_command in combination?

有帮助吗?

解决方案

Use -[RACCommand initWithEnabled:signalBlock:] instead.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top