---
title: "transformEnvironment(_:transform:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/transformenvironment(_:transform:)"
---

# transformEnvironment(_:transform:)

Transforms the environment value of the specified key path with the given function.

## Declaration

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

```

## See Also

### Modifying the environment of a view

- [environment(_:)](swiftui/view/environment(_:).md)
- [environment(_:_:)](swiftui/view/environment(_:_:).md)
