アプリの構造や動作を表す。 Settingsは、Macで有効。

App
Typeprotocol
iOS14.0+
iPadOS14.0+
macOS11.0+
MacCatalyst14.0+
tvOS14.0+
watchOS7.0+
Websitedeveloper.apple.com/documentation/swiftui/app/
@main
struct Mail: App {
    @StateObject private var model = MailModel()

    var body: some Scene {
        WindowGroup {
            MailViewer()
                .environmentObject(model) // Passed through the environment.
        }
        #if os(macOS)
            Settings {
                SettingsView(model: model) // Passed as an observed object.
            }
       #endif
    }
}

External Link

【SwiftUI】Appプロトコルのリファレンスを読む