Implicit Observable guarantees

There is also a couple of additional guarantees that all sequence producers (Observables) must honor.

It doesn't matter on which thread they produce elements, but if they generate one element and send it to the observer observer.on(.next(nextElement)), they can't send next element until observer.on method has finished execution.

Producers also cannot send terminating .completed or .error in case .next event hasn't finished.

In short, consider this example:

someObservable
  .subscribe { (e: Event<Element>) in
      print("Event processing started")
      // processing
      print("Event processing ended")
  }

this will always print:

Event processing started
Event processing ended
Event processing started
Event processing ended
Event processing started
Event processing ended

it can never print:

Event processing started
Event processing started
Event processing ended
Event processing ended

results matching ""

    No results matching ""