我需要能够在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];
}];
有什么建议吗?