MakeThreadSafeProjectionChangeset

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

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

  • Specifies the scheduler to deliver projection 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) -> DeferredHandoverProjectionChangeset<Upstream, T, S> where T : ThreadConfined, S : Scheduler

    Parameters

    scheduler

    The serial dispatch queue to receive values on.

    Return Value

    A publisher which delivers values to the given scheduler.