DTObservable 1.0.0

DTObservable 1.0.0

测试已测试
语言语言 Obj-CObjective C
许可 MIT
发布日期最新发布2015年10月

Daniel Thengvall维护。



  • 作者
  • DTHENG

简洁风格,强大作用

[[[DTObservable alloc] init:^(DTSubscriber *subscriber) {

    // Setup some data
    NSDictionary *value = @{@"4": @20};

    // Lets pretend something cpu intensive happens here
    [NSThread sleepForTimeInterval:1.f];

    // Notify the subscriber
    [subscriber next:value];
    [subscriber complete];

}] subscribe:[[DTSubscriber alloc] init:^(NSDictionary *value) {

    // Confirm the result
    BOOL fourTwenty = [value[@"4"] intValue] == 20;

    // Success!
    NSLog(@"Does 4 == 20? %@", fourTwenty ? @"YES" : @"NO");

} onError:^(NSError *error) {
    NSLog(@"%@", error);
}]];

安装

DTObservable 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中:

pod 'DTObservable', '0.4.5'

作者

DTHENG, [email protected]

许可

DTObservable 在 MIT 许可下可用。更多信息请参阅 LICENSE 文件。