Skip to content

STRUCT

AdaptedEnvironmentScreen

Wraps a Screen tree with a modified ViewEnvironment.

By specifying environmental values with this Screen, all child screens nested will inherit those values automatically. Values can be changed anywhere in a sub-tree by inserting another AdaptedEnvironmentScreen.

MyScreen(...)
    .adaptedEnvironment(keyPath: \.myValue, to: newValue)

Properties

wrapped

The screen wrapped by this screen.

Methods

init(wrapping:adapting:)

Wraps a Screen with an environment that is modified using the given configuration block.

  • Parameters:
  • wrapping: The screen to be wrapped.
  • adapting: A block that will set environmental values.

init(wrapping:key:value:)

Wraps a Screen with an environment that is modified for a single key and value.

  • Parameters:
  • wrapping: The screen to be wrapped.
  • key: The environment key to modify.
  • value: The new environment value to cascade.

init(wrapping:keyPath:value:)

Wraps a Screen with an environment that is modified for a single value.

  • Parameters:
  • wrapping: The screen to be wrapped.
  • keyPath: The keypath of the environment value to modify.
  • value: The new environment value to cascade.