1. Your View should not access your ViewModel after initialization like `viewModel.getContact()` because it can cause side effects

It should only observe the streams of outputs from ViewModel


viewModel.viewState.observe(this) { state ->

// do things with contact



I believe this is one the major differences between MVVM and MVP

2. In clean architecture, your View should not communicate to the Interactors directly but the ViewModel instead

View and ViewModel/ Presenter belongs to the Presentation layer whereas Interactors belong to the Domain layer

I like the idea of grouping ViewModel's outputs into ViewState too

The idea is further expanded here, wdyt?


Hiring Android engineer shorturl.at/bivJO Clean coder, walker & biker. Hater of inefficiency

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store