Generic Instance Method

environment(_:_:)

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

Declaration

func environment<V>(_ keyPath: WritableKeyPath<EnvironmentValues, V>, _ value: V) -> some View

See Also

Setting the Environment Values of a View

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

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