AdaptedEnvironment
public struct AdaptedEnvironment : Element
Wraps an element tree with a modified environment.
By specifying environmental values with this element, all child elements nested
will automatically inherit those values automatically. Values can be changed
anywhere in a sub-tree by inserting another AdaptedEnvironment element.
-
Takes in a mutable
Environmentwhich can be mutated to add or override values.Declaration
Swift
public typealias Adapter = (inout Environment) -> Void -
Wraps an element with an environment that is modified for a single key and value.
Declaration
Swift
public init<Key>( key: Key.Type, value: Key.Value, wrapping child: Element ) where Key: EnvironmentKeyParameters
keyThe environment key to modify.
valueThe new environment value to cascade.
wrappingThe element to be wrapped.
-
Wraps an element with an environment that is modified for a single value.
Declaration
Swift
public init<Value>( keyPath: WritableKeyPath<Environment, Value>, value: Value, wrapping child: Element )Parameters
keyPathThe keypath of the environment value to modify.
valueThe new environment value to cascade.
wrappingThe element to be wrapped.
-
Declaration
Swift
public var content: ElementContent { get } -
Declaration
Swift
public func backingViewDescription(with context: ViewDescriptionContext) -> ViewDescription?
View on GitHub
AdaptedEnvironment Structure Reference