1

これは非常に面倒です

RACSignal *originalSignal = ...;

RACSignal *mappedSignal = [[[[[originalSignal publish] autoconnect] materialize] map:^id(RACEvent *event) {
    if(event.eventType == RACEventTypeError)
    {
        return [RACEvent eventWithError:[self errorForHelperError:event.error]];
    }
    return event;
}] dematerialize];
4

1 に答える 1

8

-catch:これをよりエレガントに処理できます。

RACSignal *mappedSignal = [originalSignal catch:^(NSError *error) {
    return [RACSignal error:[self errorForHelperError:error]];
}];
于 2014-02-07T17:03:11.757 に答える