Skip to content

Instantly share code, notes, and snippets.

@anitaa1990
Created November 12, 2024 15:49
Show Gist options
  • Save anitaa1990/04b366dc39976ed66dd52f97888708bc to your computer and use it in GitHub Desktop.
Save anitaa1990/04b366dc39976ed66dd52f97888708bc to your computer and use it in GitHub Desktop.
// Presentation Layer (ViewModel) calls a Use Case
class ProfileViewModel(private val getUserProfile: GetUserProfile) : ViewModel() {
val userProfile = MutableLiveData<User>()
fun loadProfile(userId: String) {
viewModelScope.launch {
val result = getUserProfile(userId)
userProfile.value = result
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment