E
E
Eugene2019-07-05 15:49:03
Android
Eugene, 2019-07-05 15:49:03

ViewModel=MVP?

Good afternoon. Looked under the hood android arch components specifically viewModel. And it turned out that in the end it is the same presenter from Mvp. And actually the question itself. Is it normal practice to use viewmodel + livedata instead of presenter and view iterface which is passed to presenter (provided that business logic is in presenters in both cases) . For if you think so, livedata + viewModel unsubscribes itself, and viewModel does not leak during normal use.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmtm, 2019-07-05
@evgdev

the idea of ​​the presenter is to take the logic out of the View so that you can, among other things, replace the View implementation in tests,
without the presenter - will there be logic in the fragment again?
Yes, and you can subscribe to the ViewModel in the presenter itself if View is inherited from LifecycleOwner

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question