RAC(二)

2017-06-23  本文已影响12人  crazyfox

RAC常用方法

RACSignal *signal = [RACSignal createSignal:^RACDisposable *(id<RACSubscriber> subscriber) {
[subscriber sendNext:@"Signal"];
[subscriber sendCompleted];
return nil;
}];
[[signal flattenMap:^RACStream *(id value) {
return [RACReturnSignal return:value];
}] subscribeNext:^(id x) {
NSLog(@"%@",x);
}];

[[signal map:^id(id value) {
NSLog(@"%@",value);
return value;
}] subscribeNext:^(id x) {
NSLog(@"%@",x);
}];

[[signalA merge:signalB] subscribeNext:^(id x) {
NSLog(@"%@",x);
}];

[[signalA zipWith:signalB] subscribeNext:^(id _Nullable x) {
NSLog(@"%@", x);
}];

过滤
filter:
ignore:
take:
distinctUntilChanged
skip:

参考http://www.jianshu.com/p/715b7235da1d

上一篇下一篇

猜你喜欢

热点阅读