Krunoslav Zaher

10pods

Community Impact

Average
quality
301,239apps touched
34,012,837combined downloads
72,283stargazers
21,522lines of code

RxTest

Unit testing extensions for RxSwift. This library contains mock schedulers, observables, and observers that should make unit testing your operators easy as unit testing RxSwift built-in operators.

This library contains everything you needed to write unit tests in the following way: ```swift func testMap() { let scheduler = TestScheduler(initialClock: 0)

let xs = scheduler.createHotObservable([
    next(150, 1),
    next(210, 0),
    next(220, 1),
    next(230, 2),
    next(240, 4),
    completed(300)
    ])

let res = scheduler.start { xs.map { $0 * 2 } }

let correctEvents = [
    next(210, 0 * 2),
    next(220, 1 * 2),
    next(230, 2 * 2),
    next(240, 4 * 2),
    completed(300)
]

let correctSubscriptions = [
    Subscription(200, 300)
]

XCTAssertEqual(res.events, correctEvents)
XCTAssertEqual(xs.subscriptions, correctSubscriptions)

} ```

License: NOASSERTION

  • 10947 Stars
  • Great Tests
  • Great Docs
  • Swift

RxBlocking

Set of blocking operators for RxSwift. 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.

License: NOASSERTION

  • 10933 Stars
  • Great Tests
  • Great Docs
  • Swift

RxCocoa

  • UI extensions
  • NSURL extensions
  • KVO extensions

License: NOASSERTION

  • 10901 Stars
  • Great Tests
  • Great Docs
  • Swift

RxSwift

This is a Swift port of ReactiveX.io

Like the original Rx, its intention is to enable easy composition of asynchronous operations and event streams.

It tries to port as many concepts from the original Rx as possible, but some concepts were adapted for more pleasant and performant integration with iOS/macOS/Linux environment.

Probably the best analogy for those who have never heard of Rx would be:

git diff | grep bug | less # linux pipes - programs communicate by sending # sequences of bytes, words, lines, '

License: NOASSERTION

  • 10926 Stars
  • Great Tests
  • Great Docs
  • Swift

RxTests

Unit testing extensions for RxSwift. This library contains mock schedulers, observables, and observers that should make unit testing your operators easy as unit testing RxSwift built-in operators.

This library contains everything you needed to write unit tests in the following way: ```swift func testMap() { let scheduler = TestScheduler(initialClock: 0)

let xs = scheduler.createHotObservable([
    next(150, 1),
    next(210, 0),
    next(220, 1),
    next(230, 2),
    next(240, 4),
    completed(300)
    ])

let res = scheduler.start { xs.map { $0 * 2 } }

let correctEvents = [
    next(210, 0 * 2),
    next(220, 1 * 2),
    next(230, 2 * 2),
    next(240, 4 * 2),
    completed(300)
]

let correctSubscriptions = [
    Subscription(200, 300)
]

XCTAssertEqual(res.events, correctEvents)
XCTAssertEqual(xs.subscriptions, correctSubscriptions)

} ```

License:

  • 10937 Stars
  • Great Tests
  • No Docs
  • Swift

RxDataSources

This is a collection of reactive data sources for UITableView and UICollectionView.

It enables creation of animated data sources for table an collection views in just a couple of lines of code.

```swift let data: Observable = ...

let dataSource = RxTableViewSectionedAnimatedDataSource() dataSource.cellFactory = { (tv, ip, i) in let cell = tv.dequeueReusableCell(withIdentifier: "Cell") ?? UITableViewCell(style:.Default, reuseIdentifier: "Cell") cell.textLabel!.text = "(i)" return cell }

// animated data .bind(to: animatedTableView.rx.items(dataSource: dataSource)) .disposed(by: disposeBag)

// normal reload data .bind(to: tableView.rx.items(dataSource: dataSource)) .disposed(by: disposeBag) ```

License: MIT

  • 905 Stars
  • Amply Tested
  • Great Docs
  • Swift

Differentiator

Diff algorithm for UITableView and UICollectionView. RxDataSources is powered by Differentiator.

License: MIT

  • 904 Stars
  • Amply Tested
  • Great Docs
  • Swift

RxFeedback

Simplest architecture for RxSwift. State + feedback loops.

  • Simple
    • If the system doesn't have state -> congrats, you have either a pure function or an observable sequence
    • It the system does have state, here we are :)
    • Interaction with that state is by definition a feedback loop.
    • => It's just state + CQRS
  • Straightforward
    • if it's state -> State
    • if it's a way to modify state -> Event/Command
    • it it's an effect -> encode it into part of state and then design a feedback loop
  • Declarative
    • System behavior is first declaratively specified and effects begin after subscribe is called => Compile time proof there are no "unhandled states"
  • Debugging is easier

    • A lot of logic is just normal pure function that can be debugged using Xcode debugger, or just printing the commands.
  • Can be applied on any level

    • Entire system
    • application (state is stored inside a database, CoreData, Firebase, Realm)
    • view controller (state is stored inside system operator)
    • inside feedback loop (another system operator inside feedback loop)
  • Works awesome with dependency injection

  • Testing

    • Reducer is a pure function, just call it and assert results
    • In case effects are being tested -> TestScheduler
  • Can model circular dependencies

  • Completely separates business logic from effects (Rx).

    • Business logic can be transpiled between platforms (ShiftJS, C++, J2ObjC)

License: MIT

  • 283 Stars
  • Amply Tested
  • Great Docs
  • Swift

RxAlamofire

RxSwift wrapper around the elegant HTTP networking in Swift Alamofire

License: MIT

  • 768 Stars
  • Has Tests
  • Great Docs
  • Swift

RxAtomic

License: NOASSERTION

  • 14779 Stars
  • Great Docs