Skip to content

DependencyKey

tgrapperon edited this page Dec 26, 2021 · 4 revisions

DependencyKey

Conform types to this protocol to define dependencies as Dependencies computed properties.

public protocol DependencyKey 

You use this protocol like EnvironmentKey are used in SwiftUI. Types conforming to this protocol can then be used to declare the dependency in the Dependencies namespace.

Requirements

Value

associatedtype Value

defaultValue

The default value returned when accessing the corresponding dependency when no value was defined by one of its parents.

static var defaultValue: Self.Value