Posts

Post not yet marked as solved
12 Replies
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()?
Post not yet marked as solved
3 Replies
I've implemented a template picker by adding a template property to my FileDocument and checking it in the editor View and then optionally showing the template picker or the editor. This works well, but I don't see a way to dismiss the window back to the browser if they want to cancel out of the template picker.
Post not yet marked as solved
6 Replies
Also of note here is that the following code doesn't dismiss the view and the isPresented property is false in the ContentView presented by the DocumentGroup. @Environment(\.presentationMode) var presentationMode struct ContentView: View {     var body: some View { Button(action: { self.presentationMode.wrappedValue.dismiss() }) { Text("Dismiss") } } }
Post not yet marked as solved
1 Replies
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).
Post not yet marked as solved
6 Replies
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)         }     } }
Post not yet marked as solved
3 Replies
You probably want to put your NavigationView inside your ContentView