I am trying to find a solution in how to define Hilt in a certain fragment related scenario. I have the following setup:
- Activity
- Parent Fragment 1
- Child Fragment 1
- Child Fragment 2
- ...
- Child Fragment n-1
- Parent Fragment 2
- Child Fragment 1
- Child Fragment 2
- ...
- Child Fragment n-1
- Parent Fragment 1
Parent Fragment 1 is using the dependency A. The instance of that dependency is something I want to share only between that parent fragment and all of its child fragments. The parent fragment 2 + its child fragments should use a different instance than the parent fragment 1 + children. Generally his structure should have only two instances of any given dependency - one for the first flow and one for the second.
I can see that a custom scope might work here but I am uncertain about how to use that in regards to Hilt.