Ricardo C.
07/23/2020, 4:30 PMLeland Richardson [G]
07/23/2020, 5:07 PMforEach
and forEachIndexed
kotlin stdlib conventions, following the same reasons those were introducedRicardo C.
07/23/2020, 5:10 PMLeland Richardson [G]
07/23/2020, 5:11 PMColumn { for(item in items) { Item(item) } }
is equivalent to
Column { items.forEach { Item(it) } }
And we are thinking that ends up being semantically very close to
LazyColumnFor(items) { Item(it) }
Ricardo C.
07/23/2020, 5:15 PMitems.columnForEach { Item(it) }
but without being an extension. getting closer to the control flows I guessLeland Richardson [G]
07/23/2020, 5:18 PMitem, _ ->
for the lambda every time you use itAndrey Kulikov
07/23/2020, 5:21 PMLazyColumn {
item { Header() }
items(listA) { ItemA(it) }
itemsIndexed(listB) { index, item -> ItemB(index, item) }
}
Currently this api is under design. In the meantime we have
`LazyColumnItems`(or LazyColumnFor
as we will probably name it in the next release) which provided a subset of possibilities - only displaying items from one list
if we just add index for the callback here in most of the cases when you don't care about the index instead of
LazyColumnFor(list) { Text(it) }
you will have to write
LazyColumnFor(list) { _, item -> Text(item) }
we decided that given the long term plan of having a dsl for items and to make it similar to the language constructs like "forEach" and "forEachIndexed" we will provide an indexed version as a separate functionRicardo C.
07/23/2020, 5:27 PMZach Klippenstein (he/him) [MOD]
07/23/2020, 7:45 PMAndrey Kulikov
07/23/2020, 8:14 PMAdam Powell
07/23/2020, 8:29 PMZach Klippenstein (he/him) [MOD]
07/23/2020, 8:29 PMLeland Richardson [G]
07/23/2020, 8:56 PMZach Klippenstein (he/him) [MOD]
07/23/2020, 8:59 PMLeland Richardson [G]
07/23/2020, 9:01 PMAdam Powell
07/23/2020, 9:22 PMLeland Richardson [G]
07/23/2020, 9:30 PMAdam Powell
07/23/2020, 9:30 PM