Observer

public protocol Observer<Element>

A protocol representing an observer that can receive elements and a completion signal.

Contract:

  • onNext(_:) may be called zero or more times.
  • onComplete() is called at most once, always after all onNext calls.
  • After onComplete(), no further onNext calls will be made.
  • onComplete() is NOT called upon external disposal — only on natural upstream termination.
  • Undocumented

    Declaration

    Swift

    associatedtype Element
  • Called when the upstream source emits a new element.

    Declaration

    Swift

    func onNext(_ element: Element)
  • Called once when the upstream source has terminated. No further onNext calls will follow.

    Declaration

    Swift

    func onComplete()