Step into Swift logo

What is the difference between a Hot and Cold Observable in RxSwift?

Hot vs Cold Observables

RxSwift: Hot vs Cold Observable

Hot Observable

  • A “hot” Observable begins emitting elements immediately and before it is subscribed to.
  • Any observer who later subscribes to a “hot” Observable may start observing the sequence anywhere in the middle.

Cold Observable

  • A “cold” Observable begins emitting elements only when it is subscribed to.
  • A subscriber of a “cold” Observable is guaranteed to see the whole sequence from the beginning.

< All Posts