https://kotlinlang.org logo
#android-architecture
Title
# android-architecture
g

ghedeon

01/08/2019, 11:54 AM
Shared view model is a common pattern, when you use activity's VM in the fragment. What if the fragment itself has a viewmodel and they need to communicate? Do you link them on the fragment level, or you pass activity VM inside the fragment VM?
a

alexsullivan114

01/08/2019, 6:39 PM
I'm working on a project where I passed the activity VM to the fragment VM when its constructed. That worked fine for me, though I'm not sure if it introduced any memory issues...
s

sam

01/08/2019, 11:13 PM
Maybe a VM reducer?
g

ghedeon

01/09/2019, 6:08 AM
@sam so you mind to elaborate?
s

sam

01/09/2019, 2:42 PM
Basically what you said something that's taking in two ViewModels at the fragment level and giving you back the state you need
🙏 1