replacing DefaultValues instance, a.k.a. injecting globally #2
MaximBazarov
started this conversation in
Proposal
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Problem
If we have a component with dependency, inside another component we want to inject, often we have no access to the child component injections e.g. a custom
View
that usesRemoteImage
form the example in readme.If we want to test it or use in previews we can't refer to each instance of remote image.
Proposal
Extend
DefaultValues
with a static functioninject(_:_:)
usingDefaultValues.KeyPath
and add a overridden DefaultValues storage to store those, then when we resolve we can check if there's an override we provide it instead of a default instance.Beta Was this translation helpful? Give feedback.
All reactions