实际开发中经常有这样的需求,当这个页面的所有网络请求完成之后才更新UI
当信号组中每一个信号都至少一次sendNext之后
RACSignal *signal1 = [RACSignal createSignal:^RACDisposable * _Nullable(id_Nonnull subscriber) { [subscriber sendNext:@"signal1"]; return nil; }];
// [signal1 subscribeNext:^(id _Nullable x) {// NSLog(@"收到:%@",x);// }];
RACSignal *signal2 = [RACSignal createSignal:^RACDisposable * _Nullable(id_Nonnull subscriber) { [subscriber sendNext:@"signal2"]; [subscriber sendCompleted]; return nil; }];
// [signal2 subscribeNext:^(id _Nullable x) {// NSLog(@"收到:%@",x);// }];
//数组:存放信号
[self rac_liftSelector:@selector(updateUI:data2:) withSignalsFromArray:@[signal1,signal2]];
}
//注意:方法的参数一定要和信号的个数保持一一对应
- (void)updateUI:(id) dataOne data2: (id) dataTwo{
NSLog(@"更新UI");
}