Create a RACSignal that sends an error if RACSignal sends the next

With ReactiveCocoa, I'm sure there is a better way than doing this?

RACSignal *crashSignal = [cancelSignal tryMap:^id(id value, NSError **errorPtr) {
    *errorPtr = [self createError];
    return nil;
}];
+4
source share
1 answer

More idiomatic would be:

RACSignal *crashSignal = [cancelSignal flattenMap:^(id value) {
    return [RACSignal error:[self createError]];
}];
+11
source

Source: https://habr.com/ru/post/1526548/


All Articles