ObservableProtocol
public protocol ObservableProtocol : Bindable
Represents an observable sequence of events
-
The type of element in sequence.
Declaration
Swift
associatedtype Element -
asObservableDefault implementationProvides an observable sequence of a concrete object.
Default Implementation
Type erasure for any observable implementing the protocol to a general
Observable(same concept as AnyObject)Declaration
Swift
var asObservable: Observable<Element> { get } -
Subscribes to an observable sequence events.
Declaration
Swift
func subscribe<O>(_ observer: O) -> Cancelable where O : ObserverProtocol, Self.Element == O.ElementParameters
observerAn observer reacting to events of the sequence.
Return Value
Subscription object that can be used to cancel the observing.
-
create(with:)Default implementationCreates a concrete observable instance from the observable protocol.
Default Implementation
Declaration
Swift
static func create(with subscriptionHandler: @escaping SubscriptionHandler<Element>) -> Observable<Element>Parameters
subscriptionHandlerThe subscription handler to be used on new subscriptions.
Return Value
Returns a new concreate observable instance using the provided subscription handler.
-
bind(to:)Extension methodDeclaration
Swift
func bind<O>(to observer: O) -> Cancelable where O : ObserverProtocol, Self.Element == O.Element
-
subscribe(on:)Extension methodUndocumented
Declaration
Swift
func subscribe(on eventHandler: @escaping EventHandler<Element>) -> Cancelable -
subscribe(onNext:onError:onCompleted:)Extension methodUndocumented
Declaration
Swift
func subscribe(onNext: ((Element) -> Void)? = nil, onError: ((Swift.Error) -> Void)? = nil, onCompleted: (() -> Void)? = nil) -> Cancelable
ObservableProtocol Protocol Reference