-
|
I was trying to use this for testing, as shown in your examples, but my coded uses the queue both for |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Hey @JetForMe, this is a good question! Unfortunately it is not safe to expose a dispatch queue inside the The best we could do is expose a Having said that, you can still accomplish what you want without getting access to the underlying scheduler. The scheduler.schedule {
// do work
}Best of all, this works for all schedulers, whether you are really using a dispatch queue, test scheduler, immediate scheduler, etc. |
Beta Was this translation helpful? Give feedback.
Hey @JetForMe, this is a good question!
Unfortunately it is not safe to expose a dispatch queue inside the
AnySchedulerbecause it's not necessarily always powered by a real life dispatch queue. You can have aAnySchedulerOf<DispatchQueue>that secretly is a test scheduler or immediate scheduler under the hood, and so there is not real dispatch queue to expose.The best we could do is expose a
var base: Anythat exposes the underlying scheduler, but it would have to beAnybecause the type of the underlying scheduler has been completely forgotten about... which is the point of theAnyScheduler. But, if you try casting thatAnyto aDispatchQueueit will fail in tests because most likely y…