The loading state is handled in the view model code which converts info received from the repository into a PlanetsListUiState instance.
When we're told it's in the WorkResult.Loading state our view will get a PlanetsListUiState with isLoading = true, and so the UI is able to show a loading spinner or similar.
Here's the code:
val uiState = planets.map { planets ->
when (planets) {
is WorkResult.Error -> PlanetsListUiState(isError = true)
is WorkResult.Loading -> PlanetsListUiState(isLoading = true)
is WorkResult.Success -> PlanetsListUiState(planets = planets.data)
}
}
...which is a snip from Step 5 in the article, you can see more context by looking at the repo.