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