Marcello Galhardo
10/29/2021, 7:01 PMFragmentFactory but I don’t find a way to inject the Koin’s ViewModelProvider.Factory. The whole point of using FragmentFactory is to be able to do constructor injection. Is there any way to inject the ViewModelProvider.Factory in a Fragment constructor using Koin?Marcello Galhardo
11/01/2021, 9:53 AMarnaud.giuliani
11/02/2021, 11:12 AMorg.koin.androidx.fragment sources, in koin-android ?arnaud.giuliani
11/02/2021, 11:12 AMKoinFragmentFactoryarnaud.giuliani
11/02/2021, 11:13 AMMarcello Galhardo
11/02/2021, 11:29 AMViewModelProvider.Factory in the Fragment - that way I could pass a different VMP.Factory and test the Fragment in isolation without Koin. E.g.,
class MyFragment(
private val factory: ViewModelProvider.Factory,
) : Fragment() {
private val vm by viewModels { factory }
}
The FragmentFactory is working well with current set-up but I still need to use the Koin methods to access a VM, which creates a dependency between the Fragment and Koin. 🤔arnaud.giuliani
11/02/2021, 11:50 AM