Generic Instance Method

transformEnvironment(_:transform:)

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

Declaration

func transformEnvironment<V>(_ keyPath: WritableKeyPath<EnvironmentValues, V>, transform: @escaping (inout V) -> Void) -> some View

See Also

Setting the Environment Values of a View

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

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