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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.