Post

Replies

Boosts

Views

Activity

Reply to How do I programmatically dismiss a FileDocument's ContentView?
Here's a concise example of my question... import SwiftUI @main struct DocumentApp: App {     var body: some Scene {         DocumentGroup(newDocument: DocumentDocument()) { file in             ContentView(document: file.$document)         }     } } struct ContentView: View {     @Binding var document: DocumentDocument     var body: some View {         VStack {             Button(action: {                 // TODO: Dismiss ContentView and show DocumentGroup browser             }) {                 Text("Close")             }             TextEditor(text: $document.text)         }     } }
Jun ’20
Reply to Using SQLite with FileDocument and SwiftUI
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).
Jun ’20
Reply to How to open a window in SwiftUI?
You can also make a group of Scenes, but only the first one is displayed. I’d really like on iOS to transition from one scene to another (specifically a WindowGroup to a DocumentGroup) and on macOS to have the second scene to open in a new window. Why allow more than one scene per app if you can’t show one from a button click just like with Settings()?
Jun ’20