Generic Structure

EnvironmentObject

A dynamic view property that uses a bindable object supplied by an ancestor view to invalidate the current view whenever the bindable object changes.

Declaration

@frozen @propertyWrapper struct EnvironmentObject<ObjectType> where ObjectType : ObservableObject

Overview

You must set a model object on an ancestor view by calling its environmentObject(_:) method.

Topics

Initializers

Instance Methods

func update()

Updates the value of any dynamic variables prior to populating the view.

Relationships

Conforms To

See Also

Data-Dependent Views

struct State

A persistent value of a given type, through which a view reads and monitors the value.

protocol DynamicProperty

A stored variable that updates an external property of a view.