MakeThreadSafeObjectChangeset

@frozen
public struct MakeThreadSafeObjectChangeset<Upstream, T> : Publisher where Upstream : Publisher, T : ThreadConfined, Upstream.Output == ObjectChange<T>

A helper publisher created by calling .threadSafeReference() on a publisher which emits thread-confined values.

  • Specifies the scheduler to deliver object changesets to.

    This differs from subscribe(on:) in how it is integrated with the autorefresh cycle. When using subscribe(on:), the subscription is performed on the target scheduler and the publisher will emit the collection during the refresh. When using receive(on:), the collection is then converted to a ThreadSafeReference and delivered to the target scheduler with no integration into the autorefresh cycle, meaning it may arrive some time after the refresh occurs.

    When in doubt, you probably want subscribe(on:).

    Declaration

    Swift

    public func receive<S>(on scheduler: S) -> DeferredHandoverObjectChangeset<Upstream, T, S> where S : Scheduler

    Parameters

    scheduler

    The serial dispatch queue to receive values on.

    Return Value

    A publisher which delivers values to the given scheduler.