Environment

A property wrapper that reads a value from a view's environment.

ComponentiOS 13.0+macOS 10.15+tvOS 13.0+watchOS 6.0+Environment in SwiftUI

Declaration

React
import { Environment } from 'swiftui-react-native';
Swift
@frozen @propertyWrapper struct Environment<Value>

Initializers

One SwiftUI initializer backs <Environment>.

React
<Environment
  keyPath: K
>
  children: (value: SwiftUI.EnvironmentValuesReadable[K]) => ReactNode
</Environment>
Swift
init(_ keyPath: KeyPath<EnvironmentValues, Value>)

Also takes the common view props: modifiers, style and testID.

See also

More in State and environment.