简体   繁体   中英

RAC() and .rac_command are not working together

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?

请改用-[RACCommand initWithEnabled:signalBlock:]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM