Slide 23
Slide 23 text
Country Details ViewModel
class CountryDetailsViewModel : ViewModel() {
fun getDetails(country: Country): String = with(country) {
"""
Native Name: $nativeName
Demonym: ${demonym.orDash}
Population: ${String.format("%,d", population)}
Language(s): ${languages.joinToString(transform = Language::toString)}
Currency: ${currencies.joinToString(transform = Currency::toString)}
Timezone(s): ${timezones.joinToString()}
""".trimIndent()
}
}