---
title: Environment values
framework: swiftui
role: collectionGroup
role_heading: API Collection
path: swiftui/environment-values
---

# Environment values

Share data throughout a view hierarchy using the environment.

## Overview

Overview Views in SwiftUI can react to configuration information that they read from the environment using an Environment property wrapper.

A view inherits its environment from its container view, subject to explicit changes from an environment(_:_:) view modifier, or by implicit changes from one of the many modifiers that operate on environment values. As a result, you can configure a entire hierarchy of views by modifying the environment of the group’s container. You can find many built-in environment values in the EnvironmentValues structure. You can also create a custom EnvironmentValues property by defining a new property in an extension to the environment values structure and applying the Entry() macro to the variable declaration.

## Topics

### Accessing environment values

- [Environment](swiftui/environment.md)
- [EnvironmentValues](swiftui/environmentvalues.md)

### Creating custom environment values

- [Entry()](swiftui/entry().md)
- [EnvironmentKey](swiftui/environmentkey.md)

### Modifying the environment of a view

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

### Modifying the environment of a scene

- [environment(_:)](swiftui/scene/environment(_:).md)
- [environment(_:_:)](swiftui/scene/environment(_:_:).md)
- [transformEnvironment(_:transform:)](swiftui/scene/transformenvironment(_:transform:).md)

## See Also

### Data and storage

- [Model data](swiftui/model-data.md)
- [Preferences](swiftui/preferences.md)
- [Persistent storage](swiftui/persistent-storage.md)
