I'm following this tutorial on using MVVM with Retrofit
https://medium.com/@ronkan26/viewmodel-using-retrofit-mvvm-architecture-f759a0291b49
where the user places MutableLiveData inside the Repository class:
public class MovieRepository {
private static final ApiInterface myInterface;
private final MutableLiveData<EntityMovieOutputs> listOfMovies = new MutableLiveData<>();
private static MovieRepository newsRepository;
public static MovieRepository getInstance(){
if (newsRepository == null){
newsRepository = new NewsRepository();
}
return movieRepository;
}
public MovieRepository(){
myInterface = RetrofitService.getInterface();
}
I'm building a simple app and what I noticed is my repository class is quickly being filled with alot of MutableLiveData objects. Is this actually the correct way to implement MVVM, LiveData, and the Repository pattern?
from MVVM with Retrofit - How to deal with alot of LiveData in Repository?
No comments:
Post a Comment