I'd like to make an app which using:
Afaik, I need separate ViewModel
for each fragment
, is that correct? But what about repositories
? Should I make one repository for dealing with room
, and retrofit
, or should I separate them?
Yes, as per best practices, you should have a separate ViewModel for each of your fragment.
For repository, I think there should only be one repository. The repository serves data from both local (ROOM) and remote (API) source. Moreover, you might be adding some logic as well, like using local data source, when the device is offline, so having one repository is good.