Contents

SceneLaunchBehavior

The launch behavior for a scene.

Declaration

struct SceneLaunchBehavior

Overview

Use the defaultLaunchBehavior(_:) modifier to apply a value of this type to a Scene you specify in your App. The value you specify determines how the system will present the scene in the absense of any previously restored scenes on launch of your application.

For example, you may wish to present a welcome window on launch of your app when there are no previous document windows being restored:

@main
struct MyApp: App {
    var body: some Scene {
        DocumentGroup(newDocument: MyDocument()) { configuration in
            DocumentEditor(configuration.$document)
        }

        Window("Welcome to My App", id: "welcome") {
            WelcomeView()
        }
        .defaultLaunchBehavior(.presented)
    }
}

Topics

Type Properties

See Also

Configuring window visibility