Generic Instance Method

environment(_:_:)

Returns a view wrapping self that sets a value for an environment keyPath.

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

Returns a view wrapping self that transforms the value of the environment key described by keyPath by applying a transform function.