https://kotlinlang.org logo
#compose
Title
# compose
g

Gabriel

02/27/2021, 9:50 PM
I have a composable that represents a screen, with a list of items, a fab to add new items, edit buttons, delete buttons, so like 6 things I'm passing into this screen from the viewmodel
a

Adam Powell

02/27/2021, 9:54 PM
if you post the code we can give some recommendations
caller+callee if possible
g

Gabriel

02/27/2021, 9:58 PM
@Adam Bennett I'll add more but this'll give the general gist (heh) https://gist.github.com/gabriel403/9ecdf69ad51af4e1d36dc4099a1d308b
a

Adam Powell

02/27/2021, 10:06 PM
seems ok in general, you might group those params into an interface and pass a single object implementing it. Maybe that's the ViewModel itself, maybe not. Depends on how much other responsibility your ViewModel takes on
g

Gabriel

02/27/2021, 10:25 PM
Fair play, I can see a couple of ways of improving anyway, creating some composables higher up and passing them through into slots
👍 1
2 Views