RxSwift/Subjects

  • 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.)

    See more

    Declaration

    Swift

    public final class AsyncSubject<Element>
        : Observable<Element>
        , SubjectType
        , ObserverType
        , SynchronizedUnsubscribeType
  • Represents a value that changes over time.

    Observers can subscribe to the subject to receive the last (or initial) value and all subsequent notifications.

    See more

    Declaration

    Swift

    public final class BehaviorSubject<Element>
        : Observable<Element>
        , SubjectType
        , ObserverType
        , SynchronizedUnsubscribeType
        , Cancelable
  • Represents an object that is both an observable sequence as well as an observer.

    Each notification is broadcasted to all subscribed observers.

    See more

    Declaration

    Swift

    public final class PublishSubject<Element>
        : Observable<Element>
        , SubjectType
        , Cancelable
        , ObserverType
        , SynchronizedUnsubscribeType
  • Represents an object that is both an observable sequence as well as an observer.

    Each notification is broadcasted to all subscribed and future observers, subject to buffer trimming policies.

    See more

    Declaration

    Swift

    public class ReplaySubject<Element>
        : Observable<Element>
        , SubjectType
        , ObserverType
        , Disposable
  • Represents an object that is both an observable sequence as well as an observer.

    See more

    Declaration

    Swift

    public protocol SubjectType : ObservableType