Post

Replies

Boosts

Views

Activity

Reply to SwiftUI macOS DocumentGroup always crash when launching
i found the reason: ForEach is asynchronous! swift Button("Open...") {         NSDocumentController.shared.openDocument(nil)       }.keyboardShortcut("O", modifiers: .command)               MenuButton("Open Recent") {         let recents = NSDocumentController.shared.recentDocumentURLs         if recents.count 0 {           ForEach(recents, id: \.self) { url in             Button(url.lastPathComponent) {               home.open(url: url, force: true)             }           }         }         Divider()         Button("Clear Menu") {           NSDocumentController.shared.clearRecentDocuments(nil)         }       }               Button("Open Quickly...") {       }.keyboardShortcut("O", modifiers: [.command,.shift])
Apr ’21