1創(chuàng)建信號(hào)
RACSignal *signal = [RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) {
NSLog(@"發(fā)送熱門(mén)模塊");
[subscriber sendNext:@"熱門(mén)模塊的數(shù)據(jù)"];
return nil;
}];
2把信號(hào)轉(zhuǎn)換成連接類
RACMulticastConnection *connection = [signal publish];
3訂閱連接類的信號(hào)
[connection.signal subscribeNext:^(id x) {
NSLog(@"訂閱者1%@",x);
}];
[connection.signal subscribeNext:^(id x) {
NSLog(@"訂閱者2%@",x);
}];
[connection.signal subscribeNext:^(id x) {
NSLog(@"訂閱者3%@",x);
}];
4連接
[connection connect];