class UserRepository {
private val webservice: Webservice = TODO()
// ...
suspend fun getUser(userId: String) =
// This isn't an optimal implementation because it doesn't take into
// account caching. We'll look at how to improve upon this in the next
// sections.
webservice.getUser(userId)
}
我看这个网络框架是在viewmodel里直接调用apiservice进行网络请求,而标准的mvvm架构里应该是需要一个repository类来管理不同的请求数据源的,不知道作者选择去掉这一层是怎么考量的?