Step into Swift logo

What is ReactiveX?

An introduction to ReactiveX

RxSwift: An introduction to ReactiveX

  • ReactiveX is a library for composing asynchronous and event based programs by using observable sequences.
  • It extends the observer pattern.
  • Provides a collection of operators with which you can filter, select, transform, combine and compose Observables.
  • Everything is a sequence or something that works with a sequence.

Things you can do:

  • React to a property changing:
let disposeBag = DisposeBag()

let homeTeamScore = BehaviorSubject<Int>(value: 0)

homeTeamScore.subscribe(onNext: { [weak self] score in
.disposed(by: disposeBag)

  • React to a button tap (Using RxCocoa)
  .subscribe(onNext: { [unowned self] in
		self.signIn() })
  .disposed(by: disposeBag)

< All Posts