ReactiveCocoa

先看Block再看RAC会比较容易

最快让你上手ReactiveCocoa之基础篇

http://www.jianshu.com/p/87ef6720a096

RAC-MVVM

http://www.cocoachina.com/ios/20151116/14210.html

雷纯峰blog

http://blog.leichunfeng.com/blog/2016/02/27/mvvm-with-reactivecocoa/

美团技术

http://tech.meituan.com/tag/ReactiveCocoa

整理的知识

http://www.jianshu.com/p/7c1e03cf64ab

入门教程,方法解释

http://blog.csdn.net/abc649395594/article/details/46233783

信号的FlattenMap与Map

http://blog.csdn.net/abc649395594/article/details/46552865

好文

http://www.cocoachina.com/ios/20150820/13071.html

RAC双向绑定

实现switch跟随NSUserDefaults存储的值变化
RACChannelTerminal *switchTerminal = self.someSwitch.rac_newOnChannel;
RACChannelTerminal *defaultsTerminal = [[NSUserDefaults standardUserDefaults] rac_channelTerminalForKey:@"someBoolKey"];
[switchTerminal subscribe:defaultsTerminal];
[defaultsTerminal subscribe:switchTerminal];

另一个双向绑定demo
RACChannelTerminal *channelA = RACChannelTo(self, valueA);
RACChannelTerminal *channelB = RACChannelTo(self, valueB);
[[channelA map:^id(NSString *value) {
if ([value isEqualToString:@"西"]) {
return @"东";
}
return value;
}] subscribe:channelB];
[[channelB map:^id(NSString *value) {
if ([value isEqualToString:@"左"]) {
return @"右";
}
return value;
}] subscribe:channelA];

关键词理解

throttle 两个next之间的间隔时间处理,只接收第二个next,error或complete会立即响应

delay 延时操作,next,completed会延时,error会立即响应

repeat 再次订阅,when the signal completes

then 做sendCompleted之后的事情

deliverOn 运行到某个线程上

filter 过滤信号

map return一个新的数据

你可能感兴趣的:(ReactiveCocoa)