clean-architecture-swiftui
clean-architecture-swiftui copied to clipboard
DIContainer conforming EnvironmentKey - can't find its usage
Just wonder why DIContainer
conforms EnvironmentKey
in the project as I am not able to find its usage with EnviromentValues
across the project. The projects builds fine with commenting EnvironmentKey
. Could anyone explain? I don't have enough knowledge on EnvironmentKey
therefore I may miss something on how to use it.
Check the RootViewModifier on the master branch, it uses:
@Environment(\.injected) private var injected: DIContainer
which uses the
extension EnvironmentValues { var injected: DIContainer { get { self[DIContainer.self] } set { self[DIContainer.self] = newValue } } }
from the DependencyInjector.
Ah got it! I am on mvvm branch and it doesn't have the code you advised above. Thanks and problem solved!