-
Notifications
You must be signed in to change notification settings - Fork 10
DerivedEnvironment
tgrapperon edited this page Aug 31, 2021
·
8 revisions
Use this property wrapper to declare child ComposableEnvironment in a
ComposableEnvironment subclass.
@propertyWrapper
public final class DerivedEnvironment<Value> where Value: ComposableEnvironment You only need to specify the subclass used and its name. You don't need to instantiate the
subclass. For example, if ChildEnvironment is a ComposableEnvironment subclass, you can
install a representant in ParentEnvironment as:
class ParentEnvironment: ComposableEnvironment {
@DerivedEnvironment<ChildEnvironment> var child
}.This exposes a var child: ChildEnvironment read-only property in the ParentEnvironment.
This child environment inherits the current dependencies of all its ancestor. They can be
exposed using the Dependency property wrapper.
See DerivedEnvironment discussion
public init(wrappedValue: Value) See DerivedEnvironment discussion
public init() @available(*, unavailable, message: "@DerivedEnvironment should be used in a ComposableEnvironment class.")
public var wrappedValue: Value Generated at 2022-08-22T21:22:01+0000 using swift-doc 1.0.0-rc.1.