标签:接收 test nslog void subject next acs st3 方式
-(void)_test3{ RACSubject *signalofsignal = [RACSubject subject]; //信号中的信号(也就是发送的数据是信号) RACSubject *signal1 = [RACSubject subject]; RACSubject *signal2 = [RACSubject subject]; RACSubject *signal3 = [RACSubject subject]; RACSubject *signal4 = [RACSubject subject]; //订阅方式1 // [signalofsignal subscribeNext:^(id _Nullable x) { // // [x subscribeNext:^(id _Nullable x) { // // NSLog(@"接收信号中的信号的结果%@",x); // }]; // }]; //订阅方式2 (接收到最新的那个信号) [signalofsignal.switchToLatest subscribeNext:^(id _Nullable x) { NSLog(@"用 switchToLatest订阅 %@",x); }]; [signalofsignal sendNext:signal1]; [signalofsignal sendNext:signal2]; [signalofsignal sendNext:signal3]; [signalofsignal sendNext:signal4]; //发送多个信号 [signal1 sendNext:@"1"]; [signal2 sendNext:@"2"]; [signal3 sendNext:@"3"]; [signal4 sendNext:@"4"]; }
标签:接收 test nslog void subject next acs st3 方式
原文地址:https://www.cnblogs.com/liuw-flexi/p/10805806.html