does anybody ever pass viewmodels into other viewmodels, or is it better to just inject multiple viewmodels into the common view
g
gildor
12/18/2018, 3:46 PM
Inject VM into the view? what do you mean? use multiple VM for some complex view is fine for me, but you don’t inject VM to Views
r
rezenebe
12/18/2018, 3:47 PM
inject was poor choice of word, thanks
g
gildor
12/18/2018, 3:48 PM
We use this approach with injecting VM to another VM sometimes, but only if those has some related features and one VM want to call method or subscibe on another
But if we can avoid it we just use multiple VM on a single view, you have much more decoupled code in this case
➕ 1
but in our case we don’t use VM from arch components, but I don’t see how it may be different or any pitfals
s
sam
12/18/2018, 5:35 PM
We have some shared ViewModels that we pass around and some screens have multiple, it seems to work fine