Reputation: 22992
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;
}];
Upvotes: 4
Views: 1163
Reputation: 2465
More idiomatic would be:
RACSignal *crashSignal = [cancelSignal flattenMap:^(id value) {
return [RACSignal error:[self createError]];
}];
Upvotes: 11