From 21c6c9c7943116fefd40cd3ce2b960dc58859e7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gwendal=20Roue=CC=81?= Date: Thu, 25 Nov 2021 09:49:19 +0100 Subject: [PATCH] Query documentation --- Documentation/DemoApps/Query/README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/DemoApps/Query/README.md b/Documentation/DemoApps/Query/README.md index 2f0584a7a..8caabde4f 100644 --- a/Documentation/DemoApps/Query/README.md +++ b/Documentation/DemoApps/Query/README.md @@ -110,6 +110,10 @@ struct AllPlayers: Queryable { } ``` +Note in the above sample code how we make sure the views are immediately fed with database content with the `scheduling: .immediate` option. + +You will want to remove this option for database requests that are too slow. Without `scheduling: .immediate`, views will be initially fed with the `defaultValue`, and the database content will be notified later. In the meantime, your view can display some waiting indicator, or a [redacted](https://developer.apple.com/documentation/swiftui/view/redacted(reason:)) placeholder. + **Finally**, you can define a SwiftUI view that automatically updates its content when the database changes: ```swift