Scenes

Declare the user interface groupings that make up the parts of your app.

Overview 概要

A scene represents a part of your app’s user interface that has a life cycle managed by the system. An App instance presents the scenes it contains, while each Scene acts as the root element of a View hierarchy.

The system presents scenes in different ways depending on the type of scene, the platform, and the context. A scene might fill the entire display, part of the display, a window, a tab in a window, or something else. In some cases, your app might also be able to display more than one instance of the scene at a time, like when a user simultaneously opens multiple documents based on a single DocumentGroup declaration in your app.

You configure scenes using modifiers, similar to how you configure views. For example, you can adjust the appearance of the window that contains a scene — if the scene happens to appear in a window — using the windowStyle(_:) modifier. Similarly, you can add menu commands that become available when the scene is in the foreground on certain platforms using the commands(content:) modifier.

Topics 話題

Life Cycle

Primary Scenes

Secondary Scenes

Use a secondary scene to supplement a primary scene, and not as a the only scene in your app.

Scene Styles

Commands

Built-in Command Groups

See Also 参照

App Structure