Hello everyone!
For applications with multiple windows, if I close all open windows, I've noticed that visionOS reopen only the last closed window when launching the app again from the menu.
Is there a way I can set a main window that will always be open when the application is launched?
Checkout the scene modifier handlesexternalevents(matching:) and the view modifier handlesExternalEvents(preferring:allowing:). Both pages include some examples on how these modifiers can be used.
Consider adding .handlesExternalEvents(preferring: [], allowing: [])
to the root view of your secondary window. With this in place, if the user closes your app with the secondary window open, upon relaunch of the application, a new scene will be created containing the first WindowGroup.
Let me know if this helps,
Michael