I need to check two values and set conditions based on these two values, return a NS_ENUM value.
From ReactiveCocoa github readme, I find this
RAC(self, createEnabled) = [RACSignal
combineLatest:@[ RACObserve(self, password), RACObserve(self, passwordConfirmation) ]
reduce:^(NSString *password, NSString *passwordConfirm) {
return @([passwordConfirm isEqualToString:password]);
}];
It check two value, the password and passwordConfirm together. I tried to modify it a bit to observe two BOOL property, it shows me "Incompatible block pointer types" error..
RAC(self, showButtonOption) = [RACSignal
combineLatest:@[ RACObserve(self, setting), RACObserve(self, billing) ]
reduce:^(NSSet *setting, NSSet *billing) {
if ([billing containsObject:kBillingExpired]) {
return DialerShowButtonPurchase;
} else if ([setting containsObject:kSettingEnableRecord]) {
return DialerShowButtonRecord;
} else {
return DialerShowButtonCall;
}
}];
I don't know what went wrong and what should be the right syntax to serve the purpose?