热信号 vs 冷信号
1. 热信号
RACSubject *subject = [RACSubject subject];
// 第一个订阅者
[subject subscribeNext:^(id x) {
NSLog(@"Subscriber 1 received: %@", x);
}];
// 发送事件
[subject sendNext:@1];
// 第二个订阅者,此时只能接收之后的事件
[subject subscribeNext:^(id x) {
NSLog(@"Subscriber 2 received: %@", x);
}];
// 发送新事件
[subject sendNext:@2];2. 冷信号
总结
Last updated