简体   繁体   中英

ReactiveCocoa - ignore all values

I am writing a library that has a method returning a RACSignal, but only to be subscribed to Complete and Error, not Next.

I have a RACSignal, that I want to propagate further, but ignoring all values. I get the signal from network call, but I don't want to expose it's values to library user. Inside the method I am doing some things with the data, but for the user I want to expose only Complete and Error events.

RACStream has a method - (instancetype)ignore:(id)value; which returns new stream with a specific value filtered out - what I want to do is filter out all possible values. Any ideas?

You can just use filter and always return NO :

[mySignal filter:^(NSString *value) {
    return NO;
}] 

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