下載地址:https://github.com/ReactiveCocoa/ReactiveObjC
#import
一、通知
//監(jiān)聽(tīng)App離開(kāi)了__block RACDisposable*notf=[[[[NSNotificationCenter defaultCenter]rac_addObserverForName:UIApplicationWillResignActiveNotification object:nil]takeUntil:[selfrac_willDeallocSignal]]subscribeNext:^(NSNotification*_Nullable x){//分享結(jié)果回調(diào),點(diǎn)擊就算分享成功if(completion){completion(@"1",@"");//分享成功}[notf dispose];//銷毀通知}];
二、監(jiān)聽(tīng)對(duì)象屬性變化(KVO)
[[_progressView rac_valuesForKeyPath:@"progress"observer:self]subscribeNext:^(id? _Nullable x){weakself.walkProgressView.progressView.progress=[x floatValue];}];
三、Button點(diǎn)擊事件
[[cancelButton rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x){}];