Hi, I'm building an app that has more than 10 Window Groups and Immersive Spaces.
I ran into an issue where if I have more than 10, It won't compile with an error saying Extra arguments in call.
Eg:
WindowGroup(id: "Window 1"){
Debug()
}.defaultSize(width: 1000, height: 800)
...
ImmersiveSpace(id: "Space 11"){
Debug()
}.immersionStyle(selection: .constant(.mixed), in: .mixed)
I fixed it by grouping a bunch of window groups and was able to run my app, but soon realised that grouping does not work for Immersive Spaces because as soon as I opened an Immersive space from one of the groupings, It crashes citing an error from SceneManifest. It thinks the app boots up to an Immersive Space.
It looks like this:
Group {
WindowGroup(id: "Window 1"){
Debug()
}.defaultSize(width: 1000, height: 800)
...
WindowGroup(id: "Window 11"){
Debug()
}.defaultSize(width: 1000, height: 800)
}
Group {
ImmersiveSpace(id: "Space 1"){
IMView()
}.immersionStyle(selection: .constant(.mixed), in: .mixed)
}
....
ImmersiveSpace(id: "Space 11"){
IMView()
}.immersionStyle(selection: .constant(.mixed), in: .mixed)
}
SwiftUI/UIKitAppDelegate.swift:770: Fatal error: Your app was given a scene with session role UISceneSessionRole(_rawValue: UISceneSessionRoleImmersiveSpaceApplication) but no scenes declared in your App body match this role.
I can fix this by removing the groupings and having them be if I reduce the amount of views and windows.
Is there a way to overcome this limitation?