Contents

windowManagerRole(_:)

Configures the role for windows derived from self when participating in a managed window context, such as full screen or Stage Manager.

Declaration

nonisolated func windowManagerRole(_ role: WindowManagerRole) -> some Scene

Discussion

By default, the type of Scene and its placement within the app’s definition will determine the behavior of its windows within a window management context.

You can use this modifier to override the default behaivor.

For example, you can specify that a secondary Window scene should use the principal behavior for full screen and Stage Manager:

struct MyApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
        }
        Window("Organizer", id: "organizer") {
            OrganizerView()
        }
        .windowManagerRole(.principal)
    }
}

See Also

Managing window behavior