Created
June 7, 2024 06:02
-
-
Save LloydBlv/1e620c808c9eaf16800db356c0224c85 to your computer and use it in GitHub Desktop.
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
class SearchViewModel @Inject constructor(private val searchRepo: SearchRepository) : ViewModel() { | |
val searchResults: StateFlow<List<SearchResult>> | |
field = MutableStateFlow<List<SearchResult>>() | |
fun search(query: String) { | |
viewModelScope.launch { | |
val results = searchRepository.search(query) | |
searchResults.update { results } | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment