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 asynchronous code

Let's make use of a real-world example to start with—suppose you are driving down from location A to location B and along the way you want to track only the traffic lights and nothing else that is on the road; that is, you want to ignore any tolls or check posts, and so on, and focus only on the traffic lights. In other words, you want to filter out traffic lights from all the other things that you might encounter during your journey.

So how will we filter them out? The first concept that might come to your mind will be streams, since that's the concept that underpins Rx, and the second will be subscriptions. So, if you subscribe to those streams, you will be able to filter out those events. If you don't subscribe ...

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