xoangon
10/03/2023, 10:40 AMCellUiModel
data class. I want to hoist an action for cell click, and I'm torn between two approaches:
• Add an id
to the ui model and have an onCellClick: (Int) -> Unit
passed to the Composable
◦ Feels more natural not having functional variables in models
• Add a lambda property onClick: () -> Unit
to the CellUiModel
◦ Great for the type safety, but a bit weird
How would you approach it? Is there any performance considerations here?Vlad
10/03/2023, 10:57 AMonCellClick: (Int) -> Unit
or even onCellClick: (CellUiModel) -> Unit
to not bother at the controller side to find the clicked model by idxoangon
10/03/2023, 11:14 AMVlad
10/03/2023, 11:16 AMHrodrick
10/03/2023, 12:30 PMonCellClick: (CellUiModel) -> Unit
passed to the composable. It is easier to maintain and understandxoangon
10/03/2023, 1:45 PM