ObservableType
extension ObservableType
-
A bridging operator that transforms an RxSwift
ObservableType
into a CombinePublisher
.Note: A legal combine
Publisher
must limit its production to the level specified by aSubscriber
whereas an RxSwiftObservable
has no such restriction. Therefore, this operator maintains a buffer of elements from the upstreamObservable
to store until requested.To avoid out-of-memory errors, and constrain resource usage in general, it is recommended to provide a conservative value for
bufferSize
matching the expected output of the upstreamObservable
and consumption of the downstreamSubscriber
.Declaration
Swift
public func bridgeToCombine(bufferSize: Int, whenFull: RxBridgeBufferingStrategy = .fail) -> Publishers.Buffer<RxBridge<Self>>
Parameters
bufferSize
The size of the element buffer.
whenFull
The strategy to employ for handling subsequent elements if the buffer reaches capacity