RACSequence 和 RACSignal 有什么区别

What is the difference between RACSequence and RACSignal

也许我完全忽略了这一点,但根据 ReactiveCocoa on their types 上的文档,RACSequences 是信号。

不过。我看到你有这样的代码的例子:

RACSignal *letters = [@"A B C D E F G H I" componentsSeparatedByString:@" "].rac_sequence.signal;

// Outputs: A B C D E F G H I
[letters subscribeNext:^(NSString *x) {
     NSLog(@"%@", x);
}];

还有

RACSequence *letters = [@"A B C D E F G H I" componentsSeparatedByString:@" "].rac_sequence;

// Contains: AA BB CC DD EE FF GG HH II
RACSequence *mapped = [letters map:^(NSString *value) {
    return [value stringByAppendingString:value];
}];

很多例子都有 RACSequence 和 RACSignal。 rac_sequence.signal 或仅订阅信号本身有什么区别?

一个是拉驱动 (RACSequence),另一个是推驱动 (RACSignal)。来自 here:

Push-driven means that values for the signal are not defined at the moment of signal creation and may become available at a later time (for example, as a result from network request, or any user input). Pull-driven means that values in the sequence are defined at the moment of signal creation and we can query values from the stream one-by-one.

在你的情况下,你使 RACSignal 拉动,因为你已经有了它的值。