Comments (4)
The next version of the lib will not mention async sequences in the README of GRDBAsyncDemo.
Thank you for the report, @hjrnunes!
from grdb.swift.
Hello @hjrnunes,
Oh, I suppose you're surprised because there is no async sequence in GRDBAsyncDemo
.
Thank you for reporting this: I'll update my wording, so that it is less misleading.
I did try to build a SwiftUI app from the ValueObservation.values(in:)
async sequence.
Unfortunately, there is no way to tell Swift Concurrency to start an async sequence synchronously, which means that a SwiftUI view that feeds from an async sequence MUST display an empty state until the first value is produced. While some apps can live with this, some other apps can not. That's why the GRDBAsyncDemo demo is still Combine-based for the database observation feature. Combine has no problem starting a publisher synchronously, and is a better fit than Swift Concurrency for the most demanding UI applications.
If you really want to use an async sequence, there's no problem: start a Task, and iterate the values returned by ValueObservation.values(in:)
. There's no demo for that, but nothing prevents you from doing it. Your view will have to display an empty state, until the first value is produced by the Swift Concurrency runtime.
from grdb.swift.
Thanks @groue
from grdb.swift.
The doc was updated in the new version v6.27.0. Thanks again!
from grdb.swift.
Related Issues (20)
- Privacy Manifest: Entry missing for accessing file timestamps via creationDate API HOT 4
- When transaction updating multiple records in the database, if one of the records does not exist, it leads to update failure. HOT 4
- Avoid conflict with other SPM packages by renaming the CSQLite SPM target
- ValueObservation.tracking called on the updating thread HOT 5
- GRDB does not seem to copy over all rows when inserting within a migration HOT 4
- Unable to decode database NULL value as Swift nil value of type Int? when using ScopeAdapter built from splittingRowAdapters HOT 13
- App crashes with many (not all) users running iOS 17.4.1 HOT 8
- Library fails to compile when targeting Linux using a SQLite library that doesn't support snapshots HOT 3
- 0xdead10cc prevention — `checkForSuspensionViolation` on every `Statement.step` HOT 6
- Weird db read issue HOT 7
- Error for query count grouped HOT 4
- GRDB 6 missing DatabasePool/DatabaseQueue interchangeability HOT 3
- Thread running at User-initiated quality-of-service class waiting on a thread without a QoS class specified (base priority 0). Investigate ways to avoid priority inversions HOT 1
- [best practices] How can insert a same type of record into 2 tables HOT 8
- Using experimental CTE
- How to store database connection HOT 5
- How to temporarily disable observing changes? HOT 5
- Does cancelling a ValueObservation guarantee that it will never notify any more value?
- Async task with `AsyncStream` in command line app exits early without error during writing HOT 4
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 grdb.swift.