App Structure and Behavior アプリの構造と挙動

Define the entry point and top-level organization of your app. あなたのアプリのエントリポイントとトップレベル組織化を定義してください。

Overview 概要

You describe your app’s structure declaratively, much like you declare a view’s appearance. Create a type that conforms to the App protocol and use it to list the Scenes that represent aspects of your app’s user interface. To manage data model objects, instantiate them in your app structure using the StateObject property wrapper. Make these objects available to the app’s scenes and views either as direct inputs or through the Environment.

When you need to perform work in response to life cycle events, like when your app moves to the background, add the onChange(of:perform:) modifier to an appropriate scene in your app, and watch for changes in the scene’s phase. You can also use this modifier on views.

If you need to respond to the callbacks that the system traditionally makes on a UIKit, AppKit, or WatchKit app’s delegate, define a delegate object and instantiate it in your app structure using an appropriate delegate adaptor property wrapper, like UIApplicationDelegateAdaptor.

Topics 話題

App Structure

Launch Screens

Set information property list keys to tell an iOS app what to display during app launch.

App Delegates in SwiftUI

Configuration

Actions

Use an action to access certain system behaviors or to define work that the system should perform after a particular event.

See Also 参照

App Structure