Code Monkey home page Code Monkey logo

rxobjc's Introduction

RxObjC: ReactiveX for Objective-C

Build Status Version Platform codecov Carthage compatible

RxObjC is a Objective-C port of RxSwift

Current version is 1.0 ~ 2.5 RxSwift.

RxObjC 1.0 contains only core of rx, without RxCocoa module.

How install

Use CocoaPods

⚠️ IMPORTANT! For tvOS support, CocoaPods 0.39 is required. ⚠️

# Podfile
use_frameworks!

target 'YOUR_TARGET_NAME' do
    pod 'RxObjC', '~> 1.0'
end

# RxTests and RxBlocking make the most sense in the context of unit/integration tests
target 'YOUR_TESTING_TARGET' do
    pod 'RxBlocking', '~> 2.0'
    pod 'RxTests',    '~> 2.0'
end

Modules:

RxCocoa:

(see RxSwift/RxCocoa)

  • KVO extensions
  • Dealloc observing

RxBlocking:

(see RxSwift/RxBlocking) Set of blocking operators for RxObjC. These operators are mostly intended for unit/integration tests with a couple of other special scenarios where they could be useful. E.g. Waiting for observable sequence to complete before exiting command line application.

RxTests:

(see RxSwift/RxTests) Unit testing extensions for RxObjC. This library contains mock schedulers, observables, and observers that should make unit testing your operators easy as unit testing RxObjC built-in operators. This library contains everything you needed to write unit tests in the following way:

- (void)testMap {
    RxTestScheduler *scheduler = [[RxTestScheduler alloc] initWithInitialClock:0];

    RxTestableObservable *xs = [scheduler createHotObservable:@[
            next(150, @1),
            next(210, @0),
            next(220, @1),
            next(230, @2),
            next(240, @4),
            completed(300)
    ]];

    RxTestableObserver *res = [scheduler startWithObservable:[xs map:^NSNumber *(NSNumber *o) {
        return @(o.integerValue * 2);
    }]];

    NSArray *events = @[
            next(210, @(0 * 2)),
            next(220, @(1 * 2)),
            next(230, @(2 * 2)),
            next(240, @(4 * 2)),
            completed(300),
    ];
    XCTAssertEqualObjects(res.events, events);

    XCTAssertEqualObjects(xs.subscriptions, @[
            Subscription(200, 300)
    ]);
}

rxobjc's People

Contributors

pasha010 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rxobjc's Issues

структура файлов категорий observables

на примере оператора do
Файл RxObservable+Do.h
в нем перечислены все методы
в файле RxObservable+Do.m
находится имплементация методов с реализацией классов RxDoProducer и остальные вспомогательные "приватные" классы

исправить toArray

- (nonnull RxObservable<NSArray<E> *> *)toArray
->
- (nonnull RxObservable<NSArray<id> *> *)toArray // так как E - это NSArray<id> 
                                                 // а возвращаем мы поэлементно

Schedulers instance calling

like RxJava
Schedulers.new()

see QOS class naming

+ [RxSchedulers immediate]
+ [RxSchedulers default]
+ [RxSchedulers userInteractive]
+ [RxSchedulers userInitiated]
+ [RxSchedulers utility]
+ [RxSchedulers background]

RxAnyObserver

исправить

- (void)onNext:(nullable id)element;
->
- (void)onNext:(nullable E)element;

distinctUntilChanged doesn't work with nil values.

distinctUntilChanged не правильно работает с null. Посему если в NSUserDefaults подписаться на изменение ключа у которого value == nil. При любом изменении NSUserDefaults будете получать subscribeNext со значением (null).

  • (nonnull RxObservable *)distinctUntilChanged {
    return [self distinctUntilChanged:^id(id o) {
    return o;
    } comparer:^BOOL(id lhs, id rhs) {
    return [lhs isEqual:rhs];
    }];
    }
    if lhs == nil result == NO;

Weakify/Strongify

RxTimerSink in run not need strongify/weakify
check out for this issue on other operators

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.