A glance at MVI through a deck of cards
Gabor Varadi

Awesome writeup!

My post is a bit old, I should probably update it at some point. Some things I’d change:

  • No parceling of anything but String ids. ArchComponents’ ViewModel would store a Relay<ViewState> so it survives config changes.
  • Because of this, rename: Presenter -> ViewModel. (although I hate calling a class that is responsible for modeling a model.
  • No more reference of Ui from within (what’s now) the ViewModel. Inject a data layer scoped CardsUser class that represents the input a user can send to the data layer.
interface CardsUser {
  fun onInput(intention: CardsIntention)
  fun intentions() : Observable<CardsIntention>
// note: CardIntention is a sealed class
  • ViewModel now observes these intentions, and modifies state/pipes data up to the data layer accordingly
One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.