Created
August 23, 2022 10:51
-
-
Save DenisBronx/1e58753982a0131c20e9b2b560c39d1e to your computer and use it in GitHub Desktop.
Avoid Use Case Boilerplate Approach 1
This file contains 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
data class SomeModel(val id: String, val name: String) | |
interface SomeModelRepository { | |
suspend fun getSomeModels(): Answer<List<SomeModel>, String> | |
} | |
class SomeViewModel(private val someModelRepository: SomeModelRepository) : ViewModel() { | |
fun load() { | |
viewModelScope.launch { | |
val result = someModelRepository.getSomeModels() | |
// Do something with the result | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment