<@U66SV6HSQ> Dagger has custom scopes, that let yo...
# android
y
@nickk Dagger has custom scopes, that let you semantically annotate dagger components with what they representer. Create an
ActivityScope
custom scope in your code base to represent dagger components that should be alive for an instance of a given activity. Store the dagger component on the activity itself, and it’ll be garbage collected with the activity itself. Alternatively, store the dagger component on something that exists outside of the activity lifecycle, but be careful that you clean it up before configuration change or when your actiivty is finishing. It’s fine to store such things, as long as you are careful to clean them up properly to avoid memory leaks. I suggest using leak canary anyway just in case
👍 1