If I would have a `MainActivity` that implements `...
# koin
c
If I would have a
MainActivity
that implements
MainActivityInteraction
interface, and many fragments need this interface in order to communicated with the
MainActivity
, using koins
fragmentFactory
, is that achievable? I cannot actually do:
Copy code
single {MainActivity()} binds arrayOf(MainActivityInteractions::class)
fragment {BlaBlaFragment(get())} // should get the interface above
Because it's dangerous. Short question, how can I achieve interface communication between fragments and a single activity with koin
@arnaud.giuliani
t
The Android project suggests to use a shared
ViewModel
for this purpose. You’d use
by viewModel
in your activity and
by sharedViewModel
in your fragments.
c
Woww... I had completely forgotten the SharedViewModel thingy 😂. Thank you 😁
It seems like it was simpler than I thought
👍 2