Closed vanjang closed 3 weeks ago
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!
Just wonder why
DIContainer
conformsEnvironmentKey
in the project as I am not able to find its usage withEnviromentValues
across the project. The projects builds fine with commentingEnvironmentKey
. Could anyone explain? I don't have enough knowledge onEnvironmentKey
therefore I may miss something on how to use it.