BehaviorSubject
public final class BehaviorSubject<Element>
    : Observable<Element>
    , SubjectType
    , ObserverType
    , SynchronizedUnsubscribeType
    , Cancelable
                Represents a value that changes over time.
Observers can subscribe to the subject to receive the last (or initial) value and all subsequent notifications.
- 
                  
                  
Declaration
Swift
public typealias SubjectObserverType = BehaviorSubject<Element> - 
                  
                  
Indicates whether the subject has any observers
Declaration
Swift
public var hasObservers: Bool { get } - 
                  
                  
Indicates whether the subject has been disposed.
Declaration
Swift
public var isDisposed: Bool { get } - 
                  
                  
Initializes a new instance of the subject that caches its last value and starts with the specified value.
Declaration
Swift
public init(value: Element)Parameters
valueInitial value sent to observers when no other value has been received by the subject yet.
 - 
                  
                  
Gets the current value or throws an error.
Declaration
Swift
public func value() throws -> ElementReturn Value
Latest value.
 - 
                  
                  
Notifies all subscribed observers about next event.
Declaration
Swift
public func on(_ event: Event<E>)Parameters
eventEvent to send to the observers.
 - 
                  
                  
Subscribes an observer to the subject.
Declaration
Swift
public override func subscribe<O>(_ observer: O) -> Disposable where Element == O.E, O : ObserverTypeParameters
observerObserver 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() -> BehaviorSubject<Element> - 
                  
                  
Unsubscribe all observers and release resources.
Declaration
Swift
public func dispose() 
        BehaviorSubject Class Reference