I'm working on a SwiftUI app for visionOS and I'd like to support multiple windows in my app to enhance the user experience. However, I couldn't find specific documentation or examples on how to achieve this for visionOS.
In SwiftUI for iOS and iPadOS, we can create multiple windows using the .commands
modifier with a CommandGroup
for CommandGroupPlacement.newItem
and then use WindowGroup
to define the second window. However, when trying to apply the same approach in visionOS, I encountered errors like:
Value of type 'some Scene' has no member 'window'
Is there a way to create multiple windows in a SwiftUI app for visionOS? If so, how can I achieve this? Are there any specific APIs or modifiers I should use?
Any insights, code examples, or pointers to relevant documentation would be greatly appreciated.
WindowGroup(id: "SomeID")
s and opened them withopenWindow(id: "SomeID")
with the env value@Environment(\.openWindow) private var openWindow
– Nimbostratus