protocol 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 State
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 on
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 UIApplication
.