Comments (3)
UIScheduler
is probably most helpful in SwiftUI when you don't want to be too fussy about controlling the scheduler in your environment, but want to still retain some testability for non-delayed effects, since immediately scheduled work will be performed in the test without the usual thread hop of receive(on: DispatchQueue.main)
.
Otherwise it's probably mostly useful in UIKit, where certain lifecycle events happen on the main thread and a further tick will cause layout glitches, like when a UITableViewCell
is configured. In the end it should generally be useful in the same places that the ReactiveSwift scheduler is useful, but it's been awhile since I've lived in that pre-SwiftUI land, day-to-day 😅
from combine-schedulers.
The main reason we omitted the options here was because they don't seem to apply to the immediacy of a UI Scheduler.
I think generally you'd want to use AnySchedulerOf<UIScheduler>
in your application if you want to override it with a TestScheduler
in your tests.
I'm not even sure if there is any use case to actually replace UIScheduler with plain DispatchQueue. I was just used to writing this kind of API 😅
I think if you want to avoid an async "tick" when you are already processing things on the main thread, UIScheduler
can still be important. A .receive(on: UIScheduler.shared)
will not incur the cost of a thread hop, but .receive(on: DispatchQueue.main)
will.
from combine-schedulers.
On the TCA front, would you recommend to use .receive(on: UIScheduler.shared)
directly inside the reducer?
Or store it in the environment? So that there would be
struct Env {
var workScheduler: AnySchedulerOf<DispatchQueue>
var mainScheduler: AnySchedulerOf<UIScheduler>
}
And use pipe those like .subscribe(on: env.workScheduler).receive(on: env.mainScheduler)
from combine-schedulers.
Related Issues (17)
- ImmediateScheduler not returning immediately with debounce HOT 2
- Compatibility with M1 macbook (arm64) HOT 7
- Install using Carthage HOT 5
- Cannot archive build on Xcode 13 beta 3 HOT 5
- Release builds can't find XCTFail HOT 10
- Any way to convert AnySchedulerOf<RunLoop> back to RunLoop? HOT 1
- iOS 13 EXC_BAD_INSTRUCTION HOT 3
- EXC_BAD_ACCESS crash with iOS 15.2 HOT 6
- Can't get version 0.7.0 compile on Xcode 14 beta 1 HOT 1
- Build documentation on Xcode14b5 for projects including `CombineSchedulers` fail HOT 1
- Simulate the inaccuracy of schedulers HOT 3
- Subscriber does not receive values when `.subscribe(on: scheduler).receive(on: scheduler)` used with the TestScheduler HOT 6
- Cannot find Publishers HOT 1
- When compiled with library evolution turned on, the resulting .swiftinterface file is not compiling. HOT 2
- Update underlying `XCTestSchedulers` package HOT 2
- cocoapods spec not found HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from combine-schedulers.