ObservableType

extension ObservableType
  • A bridging operator that transforms an RxSwift ObservableType into a Combine Publisher.

    Note: A legal combine Publisher must limit its production to the level specified by a Subscriber whereas an RxSwift Observable has no such restriction. Therefore, this operator maintains a buffer of elements from the upstream Observable 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 upstream Observable and consumption of the downstream Subscriber.

    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