This code works as expected. If you change the if statement to [RACSignal return:@1]
then YES
will be printed.
EDITED
The both methods are called because they are just a parameters for [RACSignal if:then:else:]
method.
ReactivCocoa will call subscribeNext/subscribeComplited for the provided signal according to if if
signal return YES
or NO
.
So if you wan do sth for YES:
-(RACSignal)rac_testYES {
return [RACSignal createSignal:^RACDisposable *(id <RACSubscriber> subscriber) {
//do sth
[subscriber sendNext:@"YES"];
[subscriber sendComplited];
}
}
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.