Skip to content

Instantly share code, notes, and snippets.

@SunXiaoShan
Created July 7, 2017 08:34
Show Gist options
  • Save SunXiaoShan/86000c64afcd5fd11f4d2a9b5a50c491 to your computer and use it in GitHub Desktop.
Save SunXiaoShan/86000c64afcd5fd11f4d2a9b5a50c491 to your computer and use it in GitHub Desktop.
SignalExample - ReactiveObjC
// 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