Bob Redity
Bob Redity

Reputation: 621

How to call method in ViewModel from another ViewModel?

In my ViewModelOne I need to call a method from ViewModelTwo. How can I do that and is it a good practice?

Upvotes: 0

Views: 1288

Answers (1)

Yousef Kazemi
Yousef Kazemi

Reputation: 164

In clean code and MVVM structure(common way), Actually in a ViewModel, You don't have access to another ViewModel. You can use SharedViewModel to communicate via view(Fragment).

Upvotes: 1

Related Questions