0

Do you know this library? https://github.com/inloop/AndroidViewModel Why is named as ViewModel? I think that it is MVP pattern.

elnino
  • 235
  • 3
  • 12

1 Answers1

2

I am one of the authors. It's only a naming thing - yes, a more precise name would contain the word Presenter and it's more close to a MVP than to MVVM. The difference is that our Presenter/ViewModel works the same way as the Google's ViewModel in terms of lifecycle awareness. It's persisted during orientation change and discarded when you leave the Fragment or Activity. And you can also use databinding istead of getView() and this would be now closer to the ViewModel definition. So it's more like a hybrid approach.

The name is because of historical reasons as the original internal library was named this way.

Daniel Novak
  • 2,746
  • 3
  • 28
  • 37