Demo apps: document why we use .immediate observation scheduling

This commit is contained in:
Gwendal Roué committed 2021-10-19 08:55:41 +02:00
1 parent 5d69d2a35b
commit 0d8d40d683
3 files changed
+8 -2

No files matched your search

@@ -33,7 +33,9 @@ struct PlayerRequest: Queryable {
.trackingConstantRegion(fetchValue(_:))
.publisher(
in: appDatabase.databaseReader,
scheduling: .immediate) // Feed the view without delay
// Immediate scheduling feeds the view right on subscription,
// and avoids an undesired animation when the application starts.
scheduling: .immediate)
.eraseToAnyPublisher()
}
@@ -33,7 +33,9 @@ struct PlayerRequest: Queryable {
.trackingConstantRegion(fetchValue(_:))
.publisher(
in: appDatabase.databaseReader,
scheduling: .immediate) // Feed the view without delay
// Immediate scheduling feeds the view right on subscription,
// and avoids an undesired animation when the application starts.
scheduling: .immediate)
.eraseToAnyPublisher()
}
@@ -110,6 +110,8 @@ class PlayerListViewController: UITableViewController {
.tracking(request.fetchAll(_:))
.start(
in: AppDatabase.shared.databaseReader,
// Immediate scheduling feeds the data source right on subscription,
// and avoids an undesired animation when the application starts.
scheduling: .immediate,
onError: { error in fatalError("Unexpected error: \(error)") },
onChange: { [weak self] players in