Using SQLite with FileDocument and SwiftUI

Hi all,

I've been playing with the new SwiftUI templates and am confused about using the new FileDocument API.

The docs state you should use a value type and that read/write will be threaded.

My app uses an SQLite database for data management. It does read/write incrementally without explicit save points.
It also doesn't read the file into memory, but queries it as needed.

What would be the correct way to handle this with SwiftUI?

Should I fake reading the file on open and never report any changes to save?

Thank you.
You should probably be using CoreData for your SQLite storage. You could use a sqlite file with FileDocument, but you'd have to handle the reading and writing and management of that by yourself (which is what CoreData does). FileDocument is for documents, like a pages or numbers document or a file of some type (or a custom one that you create).
Using SQLite with FileDocument and SwiftUI
 
 
Q