AsyncSubject

public final class AsyncSubject<Element>
    : Observable<Element>
    , SubjectType
    , ObserverType
    , SynchronizedUnsubscribeType

An AsyncSubject emits the last value (and only the last value) emitted by the source Observable, and only after that source Observable completes.

(If the source Observable does not emit any values, the AsyncSubject also completes without emitting any values.)

  • Undocumented

    Declaration

    Swift

    public typealias SubjectObserverType = AsyncSubject<Element>
  • Indicates whether the subject has any observers

    Declaration

    Swift

    public var hasObservers: Bool { get }
  • Creates a subject.

    Declaration

    Swift

    public override init()
  • Notifies all subscribed observers about next event.

    Declaration

    Swift

    public func on(_ event: Event<Element>)

    Parameters

    event

    Event to send to the observers.

  • Subscribes an observer to the subject.

    Declaration

    Swift

    public override func subscribe<Observer>(_ observer: Observer) -> Disposable where Element == Observer.Element, Observer : ObserverType

    Parameters

    observer

    Observer to subscribe to the subject.

    Return Value

    Disposable object that can be used to unsubscribe the observer from the subject.

  • Returns observer interface for subject.

    Declaration

    Swift

    public func asObserver() -> AsyncSubject<Element>