Support Combine Assign subscriber in RxSwift

RxAssign

Support Combine Assign subscriber in RxSwift.

Assign uses a KeyPath which is really nice and useful.

** RxAssign extends Driver and Signal in RxCocoa.

At a Glance

Assign element with key path.

Driver.of("hello")
    .assign(to: \.text, on: titleLabel)
    .disposed(by: disposeBag)

Signal.of("world")
    .assign(to: \.text, on: titleLabel)
    .disposed(by: disposeBag)

These equivalent to assign

  1. Subscribe using emit(or drive) and assign.

class Test {
    var title: String = ""
}

Signal.of("world")
    .emit { (title: String) in
        test.title = title
    }
    .disposed(by: disposeBag)
  1. Adopt ObserverType in Object and emit(or drive).

Requirements

RxSwift, RxCocoa 5.0+

Installation

Swift Package Manager

Project > Project Dependencies > Add   https://github.com/heoblitz/RxAssign

License

MIT

GitHub

View Github