SwiftData
SwiftData copied to clipboard
Multiple threads
All SwiftData operations are placed on a custom serial queue ("SwiftData.DatabaseQueue") and executed in a FIFO order. Thats great, but is there a way I could set my own queue? Imagine following scenario: I am saving a lot of data in background thread, but I don't want to freeze main UI thread in which the data are fetching/selecting. It is happening because all SQL queries are executed in same serial queue. It would be great if I can write into database in one queue and read from database in another.
I'm looking into the easiest way to implement this without generating a bunch of errors. I have to do some research on concurrency in SQLite ...