Creating a second window with SWIFTUI in MACOS

I have seen many questions on the forum for how to create a second window (or more) using the Swift life cycle on MACOS. None of the solutions seem to be very good and most of them are a year or more old.

Has anyone come up with a good solution for this? Maybe using an AppDelegate?

For example when I add a new scene in the App file SwiftUI automatically adds the option to create a new window of that scene type in the File menu.

Here you can see that I have added a second scene.

Here you can see that now in the file menu I have the option to open a new window of either scene type. How do I do this same thing with a button? I want to have a button in a window for example that would call the ChartView scene and create a new window with it.

I have seen examples like [https://developer.apple.com/forums/thread/651592)

These examples basically open a URL with the app name and scene name. In these examples you also need to add the App URL to the info.plist and App info -> URL types. The problem is when I build these solutions in Xcode 13.2.1 and then click the button I get a popup window with the finder icon that says the application cannot be opened and it has an error code of -50.

Creating a second window with SWIFTUI in MACOS
 
 
Q