Step into Swift logo

RxSwift onNext, onCompleted, onError, ohMy!!

onNext, onCompleted, onError

RxSwift: onNext, onCompleted, onError

onNext

  • Called by the Observable when it emits an item.
  • Takes as a parameter the item emitted by the Observable.
  • Calls are referred to as emissions.

onError

  • Called to indicate that the Observable has failed to generate the expected data or has encountered an error.
  • Observable will terminate.
  • No more calls to onNext or onCompleted.
  • Takes a parameter an indication of what caused the error.
  • Calls are referred to as notifications.

onCompleted

  • Called after the Observable has called onNext for a final time (If no errors have occurred).
  • Calls are referred to as notifications.

< All Posts