ObserverType
public protocol ObserverType
Supports push-style iteration over an observable sequence.
-
The type of elements in sequence that observer can observe.
Declaration
Swift
associatedtype E
-
asObserver()
Extension methodErases type of observer and returns canonical observer.
Declaration
Swift
public func asObserver() -> AnyObserver<E>
Return Value
type erased observer.
-
mapObserver(_:)
Extension methodTransforms observer of type R to type E using custom transform method. Each event sent to result observer is transformed and sent to
self
.Declaration
Swift
public func mapObserver<R>(_ transform: @escaping (R) throws -> E) -> AnyObserver<R>
Return Value
observer that transforms events.
-
onNext(_:)
Extension methodConvenience method equivalent to
on(.next(element: E))
Declaration
Swift
public func onNext(_ element: E)
Parameters
element
Next element to send to observer(s)
-
onCompleted()
Extension methodConvenience method equivalent to
on(.completed)
Declaration
Swift
public func onCompleted()
-
onError(_:)
Extension methodConvenience method equivalent to
on(.error(Swift.Error))
Declaration
Swift
public func onError(_ error: Swift.Error)
Parameters
error
Swift.Error to send to observer(s)