Generic Instance Method

environmentObject(_:)

Supplies a bindable object to a view subhierachy.

Declaration

func environmentObject<B>(_ bindable: B) -> some View where B : BindableObject

Parameters

bindable

the object to store and make available to the view’s subhiearchy.

Discussion

The object can be read by any child by using EnvironmentObject.

See Also

Setting the Environment Values of a View

func environment<V>(WritableKeyPath<EnvironmentValues, V>, V) -> View

Sets the environment value indicated by a key path to the given value.

Beta
func transformEnvironment<V>(WritableKeyPath<EnvironmentValues, V>, transform: (inout V) -> Void) -> View

Transforms the environment value indicated by a key path with the given function.

Beta

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software