ReactiveCocoa笔记2

RACSubject 与 RACReplaySubject

 RACReplaySubject *replaySubject = [RACReplaySubject subject];
    [replaySubject sendNext:@"RACReplaySubject可以先发送消息再订阅"];
    [replaySubject subscribeNext:^(id x) {
        NSLog(@"%@", x);
    }];
    
    
    RACSubject *subject = [RACSubject subject];
    [subject subscribeNext:^(id x) {
        NSLog(@"%@", x);
    }];
    [subject sendNext:@"subject只能先订阅再发送消息"];

你可能感兴趣的:(ReactiveCocoa笔记2)