It’s become a norm to architect our code bases with either of the most popular architecture patterns. It’s even become a thing to have a hard time making decision on which pattern to pick given a number of options are available out there nowadays.
MVI is one of the latest to join the MV* gang in android Community. It best solves the state management problem by making the data/business logic drives the app’s state and leveraging data immutability. We’ll dive into the nitty-gritty of managing states the MVI way.
Views in android are already complex in its nature. MVI makes the view as dump and passive as possible to the point where the only concern left for a view is rendering data and firing events. Nothing more.
We’ll also go through a technique for building complex UI using a single recycler view with the help of Epoxy library which works very well with MVI. And of course, some caveats of using this library along with MVI.
Not necessarily a requirement but MVI shines the brightest when used together with reactive framework like Rxjava. Here’s the thing, simply using Rxjava doesn’t make your app reactive. You might have heard or seen something similar to this a couple of times, I’m using Rxjava/LiveData but still have to refresh the calls to get the latest updates when come back from another screen ¯_(ツ)_/¯. We’ll go through the process of making our app fully reactive. No more refresh.
Needless to advocate much for the benefits clean architecture has to offer. It’s here to stay. It ensures that components with different purposes will sit at their respective places thus enable us to concern about only one thing at a place. It makes sure the more important business logic doesn’t depend on the less important implementation details. The list goes on and on. On the other hand, MVI is just a view layer pattern so it still needs something which is capable of all these cool things. Then comes the clean MVI.