How to show programatically a DocumentGroup in visionOS?

WindowGroups have ids, like this: WindowGroup(id: "window_id"), but DocumentGroups do not have. So opening like this does not work: openWindow(id: "window_id").

The problem is that if the user dismisses the DocumentGroup, there is no way to reopen it again.

Replies

// When it is dismissed, there is no way to bring it back.
DocumentGroup(newDocument: { TestDocument() }) { file in
    ContentView()
}

// I can bring it back by opening it with its ID.
WindowGroup(id: "TestWindow") {
    TestWindowView()
}
.windowStyle(.plain)

Here is some more information about the issue.