The retry operator

The retry operator does not really handle the error. It just ignores it, and it will resubscribe to an Observable that emits an error. Let's start with the implementation. We will define a shouldEmitError that equals true, which we will use as a quick way to prevent our sequence subscription from retrying indefinitely in this example. Now we will create an Observable sequence of the Int type, as follows:

example(for: "retry") {    let disposeBag = DisposeBag()    var shouldEmitError = true        let observableSeq = Observable<Int>.create{ observer in            }}

We will add two next events to the observer, which will be emitted to the subscribers. This is another way to create an Observable sequence using create and manually building it up ...

Get Reactive Programming with Swift 4 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.