Dependency-propagating Schedulers #85
kabiroberai
started this conversation in
Ideas
Replies: 1 comment 2 replies
-
@kabiroberai swift-dependencies depends on combine-schedulers and swift-clocks, and not the other way around, so I'm not sure it's really possible for us to propagate dependencies automatically without combining these libraries. Your |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Update: There's now a PR for this: see #86.
Scheduler APIs currently fail to propagate dependencies across the
schedule
boundary:If swift-dependencies didn't claim to support schedulers at all this would maybe be acceptable, but there's even a
mainQueue
dependency so it's extra strange that using it doesn't propagate deps. Plus, it'd be nice if we eased the transition from Combine to Concurrency by somewhat supporting Dependencies in the latter.One approach to solve this is to add a
dependencies
modifier toScheduler
, similar toanimation
/transaction
:Under the hood this would wrap the
schedule
calls inwithEscapedDependencies
to propagate the continuation.We could also make all built-in CombineSchedulers (e.g.
UIScheduler
) forward dependencies by default, or at least do so for themainQueue
dependency. Would be happy to put up a PR to 1) addScheduler.dependencies
and 2) forward dependencies onmainQueue
— curious to hear other people's thoughts.Beta Was this translation helpful? Give feedback.
All reactions