Created
May 21, 2022 04:02
-
-
Save MamboBryan/732e5e3e85d5f9b8c05c57a7f08bc4de to your computer and use it in GitHub Desktop.
The viewmodel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.mambobryan.samba.ui.characters | |
import androidx.lifecycle.ViewModel | |
import androidx.lifecycle.viewModelScope | |
import androidx.paging.cachedIn | |
import com.mambobryan.samba.data.repositories.CharactersRepository | |
import dagger.hilt.android.lifecycle.HiltViewModel | |
import javax.inject.Inject | |
@HiltViewModel | |
class CharactersViewModel @Inject constructor( | |
repository: CharactersRepository | |
) : ViewModel(){ | |
val articles = repository.getCharacters().cachedIn(viewModelScope) | |
val articlesWithCache = repository.getCharactersWithCache().cachedIn(viewModelScope) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment