environment object
Last updated
Was this helpful?
Last updated
Was this helpful?
โฉ โฉ โฉ object
An environment object is a , which is
initialized in an ancester view by adding a property
and put in the environment by calling the ancester view's modifier.
To use an environment object In a , declare a corrspoinding property in the subview.
Be sure to set a corresponding instance on an ancester view by calling its modifier.
ObservableObject๏ผdeclare an observable object .
@Published๏ผdeclare in an type.
@StateObject๏ผinitialize an .
Use to put the in the environment.
Use to declare an property provided by an ancestor view.
๏ผ any or object that uses the 's data.
๏ผdata shared with any views in your app.
โฉ โฉ
โฉ (protocol)
โฉ โฉ (property wrapper)
Majid โฉ #todo