标签:
__block int i = 0; [[[RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) { if (i == 10) { [subscriber sendNext:@1]; }else{ NSLog(@"接收到错误"); [subscriber sendError:nil]; } i++; return nil; }] retry] subscribeNext:^(id x) { NSLog(@"%@",x); } error:^(NSError *error) { NSLog(@“error = %@",error); }];
RACSignal *signal = [[RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) { [subscriber sendNext:@1]; [subscriber sendNext:@2]; return nil; }] replay]; [signal subscribeNext:^(id x) { NSLog(@"第一个订阅者%@",x); }]; [signal subscribeNext:^(id x) { NSLog(@"第二个订阅者%@",x); }];
RACSubject *signal = [RACSubject subject]; _signal = signal; // 节流,在一定时间(1秒)内,不接收任何信号内容,过了这个时间(1秒)获取最后发送的信号内容发出。 [[signal throttle:1] subscribeNext:^(id x) { NSLog(@"%@",x); }];
标签:
原文地址:http://www.cnblogs.com/HMJ-29/p/4944009.html