I am using the new MultiPlatform SwiftUI Document template in Xcode 12 and I don't understand how to get access to the current FileDocument from within a menu item.
My app code looks like this (straight from the template).
My app code looks like this (straight from the template).
Code Block swift @main struct MyApp: App { var body: some Scene { DocumentGroup(newDocument: MyDocument()) { file in ContentView(document: file.$document) } .commands { CommandMenu("Utilities") { Button(action: { /*How to get access to the current FileDocument ?*/ }) { Text("Test") } } } } }