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 practice with HotObservables

We are starting off with an Xcode project with a unit test target and a single testing file. In case you are not familiar, a unit test class in iOS is a subclass of XCTestCase that provides several features, including the setUp() and tearDown() methods, that are run before every test, as shown in this code:

override func setUp() {        super.setUp()    }    override func tearDown() {    }

We will now define scheduler and subscription properties that will be used by the tests and then, in setup, we will initialize the scheduler with an initialClock value of 0. This is the beginning of time as far as the scheduler is concerned, and once the time reaches 1000 milliseconds, we will dispose of the subscription in ...

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