美文网首页
RACMulticastConnection

RACMulticastConnection

作者: CaesarsTesla | 来源:发表于2016-05-29 23:05 被阅读81次

    1创建信号

     RACSignal *signal = [RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) {
        NSLog(@"发送热门模块");
        [subscriber sendNext:@"热门模块的数据"];
        return nil;
    }];
    

    2把信号转换成连接类

    RACMulticastConnection *connection = [signal publish];
    

    3订阅连接类的信号

     [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];

    相关文章

      网友评论

          本文标题:RACMulticastConnection

          本文链接:https://www.haomeiwen.com/subject/gumqdttx.html