Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
@Composable
fun LifecycleAwareCurrenciesScreen(viewModel: LifecycleAwareCurrenciesViewModel) {
val currencyPrices = viewModel.currencyPrices.collectAsState()
LazyColumn {
itemsIndexed(currencyPrices.value) { index, currencyPrice ->
LifecycleAwareCurrencyPriceCard(
currencyPrice = currencyPrice,
currencyPriceUpdateFlow = viewModel.provideCurrencyUpdateFlow(),
onDisposed = { viewModel.onDisposed(index) },
onCurrencyUpdated = { newPrice -> viewModel.onCurrencyUpdated(newPrice, index) })
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment