Hey folks, we are investigating Anvil as a DI solu...
# squarelibraries
h
Hey folks, we are investigating Anvil as a DI solution. Is there a way to not add inject function to components for every activity or fragment and use some kind of generic solution?
r
That’s a better question for #dagger. Anvil doesn’t change anything in this regard. I don’t have a good answer for you.
n
is there any reason why you don't want to use Hilt for that ?
h
@ralf good point. I will try to explain the problem. We try to keep modules as much isolated as possible so for injecting new object we don't want go to other module to put inject function there. For dagger as I know isolation is not possible so for dagger users it's okay to put injection function in other module’s component. So that's why usually they don't face this problem. But you are right actually it's question to dagger
@nitrog42 We are planning to get rid of android core components such as activity fragment, view model so for other cases hilt is useless
👍 1
r
@Hakob Astvacatryan I now understand what you’re asking. You can do this with Anvil: https://github.com/square/anvil#anvil Look at the first sample. You want something similar like
ComponentInterface
.
👍 1
This way you don’t need to touch any other module.