RACSignal doNext带信号

时间:2015-04-09 01:27:36

标签: ios reactive-programming reactive-cocoa

我需要能够在doNext内部使用信号,而不仅仅是块。问题是我也使用信号进行副作用。

当我执行此类操作时,我的代码看起来非常混乱。

例如:

[httpRequestSignal flattenMap:^(Response *response) {
    // Save the response.
    return [[self saveResponse:response] then:^{
        // Return the response.
        return [RACSignal return:response];
    }];
}];

我很想使用first并使代码看起来更好,但看起来错误使信号同步。

[httpRequestSignal doNext:^(Response *response) {
    // Save the response.
    [[self saveResponse:response] first];
}];

有什么建议吗?

0 个答案:

没有答案