iosswiftswiftuiipadosuiscene

iOS - Is there a programmatically way to create multiple windows that don't split the screen?


I'm using UIScenes and SwiftUI to create a simple app.

I need to create multiple windows programmatically, but not with the same design outcome from requestSceneSessionActivation, that splits the screen into 2 pieces. I need the other one, like the image... enter image description here

I didn't find anything in the UIScene documentation for it. If you know a way to close it too, it would be awesome!


Solution

  • Unfortunately UISceneActivationRequestOptions (passed to requestSceneSessionActivation) doesn't provide an option to specify how the new scene should be presented. Oddly there is a UIWindowSceneDestructionRequestOptions class for indicating how a scene can be dismissed. There should be a UIWindowSceneActivationRequestOptions class that allows you specify how it is shown. I suggest filing an enhancement request with Apple using the Feedback app on iOS 13.

    Closing a scene can be done using UIApplication requestSceneSessionDestruction.