@main
struct mindoApp: App {
		@UIApplicationDelegateAdaptor private var appDelegate: AppDelegate
		var body: some Scene {
						 WindowGroup {
											 ContentView()
						 }
		 }
}
class AppDelegate: NSObject, UIApplicationDelegate {
		func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
				if options.userActivities.first?.activityType == "newWindow" {
					 let configuration = UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
					 configuration.delegateClass = SceneDelegate.self
					 return configuration
				} else {
					 return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
			 }
}
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
		var window: UIWindow?
		func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
				if let windowScene = scene as? UIWindowScene {
						let window = UIWindow(windowScene: windowScene)
						window.rootViewController = UIHostingController(rootView: TestView())
						self.window = window
						window.makeKeyAndVisible()
				}
		}
}
The following code is used to create a new scene/window
				UIApplication.shared.requestSceneSessionActivation(nil, userActivity: NSUserActivity(activityType: “newWindow"), options: nil, errorHandler: nil)
The TestView can be put into the second scene/window on iPadOS/macOS. But, the App crashes when closing the second scene/window:
Fatal error: Attempted to read an unowned reference but object 0x60000061d1c0 was already deallocated