Generic Structure


A property wrapper type that reads a value from the view’s environment.


@frozen @propertyWrapper struct Environment<Value>


Creating an Environment Instance

init(KeyPath<EnvironmentValues, Value>)

Creates an environment property to read the specified key path.

Getting the Value

Updating the Value

func update()

Updates the value of the property prior to populating the view.

Supporting Types

protocol EnvironmentKey

A protocol that represents an environment key.

protocol EnvironmentalModifier

A modifier that must resolve to a concrete modifier in an environment before use.


Conforms To

See Also

Environment Data

struct EnvironmentValues

A collection of environment values propagated through a view hierarchy.

struct EnvironmentObject

A property wrapper type for an observable object supplied by a parent or ancestor view.