DTObservable 1.0.0

DTObservable 1.0.0

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Oct 2015

Maintained by Daniel Thengvall.



  • By
  • DTHENG

Simple style, powerful implications

[[[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);
}]];

Installation

DTObservable is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'DTObservable', '0.4.5'

Author

DTHENG, [email protected]

License

DTObservable is available under the MIT license. See the LICENSE file for more info.