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.

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