O'Reilly logo

Reactive Programming with Swift 4 by Navdeep Singh

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Testing in RxTest with ColdObservables

To show an example of working with a ColdObservable in RxTest, we will duplicate the previous example and change the name.

A ColdObservable in RxTest will only emit when there is a subscriber, and it will emit all its events to each subscriber on subscription. We will create two subscriptions in this example, so rather than using the subscription's dispose() property, we will use disposeBag this time. We will need two observers for this example, so we will duplicate the single one and then rename them as follows:

let disposeBag = DisposeBag()let firstObserver = scheduler.createObserver(Int.self)let secondObserver = scheduler.createObserver(Int.self)

Also, we will need two map Observables to test that ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required