SwiftUI/Protocol/App
| Type | protocol |
|---|---|
| iOS | 14.0+ |
| iPadOS | 14.0+ |
| macOS | 11.0+ |
| MacCatalyst | 14.0+ |
| tvOS | 14.0+ |
| watchOS | 7.0+ |
| Website | developer |
アプリの構造や動作を表す。 Settingsは、Macで有効。
@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
}
}