Just wanted to mention that I adapted Rob's answer from earlier and converted it to a custom Publisher, in order to allow for a single unbroken pipeline (see comments below his solution). My adaptation is below, but all the credit still goes to him. It also still makes use of Rob's step
operator and SteppingSubscriber
, as this custom Publisher uses those internally.
Edit: updated with buffer as part of the modulated
operator, otherwise that would be required to be attached to buffer the upstream events.
public extension Publisher {
func modulated(_ pace: Context.SchedulerTimeType.Stride, scheduler: Context) -> AnyPublisher