深入理解RACSignal相关operation

- (RACSignal *)merge:(RACSignal *)signal {
    return [RACSignal
            merge:@[ self, signal ]];      //(1)
}
+ (RACSignal *)merge:(id<NSFastEnumeration>)signals {
    NSMutableArray *copiedSignals = [[NSMutableArray alloc] init];
    for (RACSignal *signal in signals) {
        [copiedSignals addObject:signal];     //(2)
    }
    return [[RACSignal
              createSignal:^ RACDisposable * (id<RACSubscriber> subscriber) {   //(3)
                  for (RACSignal *signal in copiedSignals) {
                      [subscriber sendNext:signal];             //(4)
                  }
                  [subscriber sendCompleted];
                  return nil;
              }]flatten];                 //(5)
}

推荐阅读更多精彩内容