Created
July 7, 2017 08:34
-
-
Save SunXiaoShan/86000c64afcd5fd11f4d2a9b5a50c491 to your computer and use it in GitHub Desktop.
SignalExample - ReactiveObjC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create signnal | |
RACSignal *signal = [RACSignal createSignal:^RACDisposable * _Nullable(id<RACSubscriber> _Nonnull subscriber) { | |
[subscriber sendNext:@"message"]; | |
return nil; | |
}]; | |
// subscribe notification | |
RACDisposable *disposable = [signal subscribeNext:^(id _Nullable x) { | |
NSLog(@"content:%@", x); | |
}]; | |
// cancel subscribe | |
[disposable dispose]; | |
// output | |
// content:message |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment