A screencast on time-based prefixing in Combine
26 Apr 2020(Assumed audience: folks with some working knowledge of Combine.)
Updates:
6/17/20:
The test expectations have since been swapped out for Point-Free’s TestScheduler
implementation.
4/28/20:
While PR’ing the operator, I looked into whether or not the prefix(1)
safety net is needed and…it isn’t!
Woot.
Combine uses back pressure to request a single value from untilOutputFrom
and the subsequent finished event cancels everything out from there.
To check this, we can spin up a Playground:
I recorded my first screencast slash lecture slash live-coding episode thing!
In it—and from David’s mentioning in iOS Folks’ #reactive channel—, I implement a time-based overload on Publisher.prefix
, while talking through nuances like fusion, ConnectablePublisher
, and TestScheduler
.
I hope this encourages folks to experiment with composed operators and, if they see fit, contribute to CombineExt.
■
Related links
⇒ “Multicasting, Publisher.share(replay:), and ReplaySubject”
⇒ Entwine’s implementation of a TestScheduler
type.
⇒ OpenCombine’s VirtualTimeScheduler
.