https://kotlinlang.org logo
Title
v

vide

02/17/2023, 5:11 PM
I'm wondering if there's any way to optimize a layout like this to not destroy and compose ComplexSharedLayout from scratch?
if (layout1) { Layout1(); ComplexSharedLayout() } else { Layout2(); ComplexSharedLayout() }
Any other possibilities than this?
if (layout1) { Layout1() } else { Layout2() } ComplexSharedLayout()
Although in the specific example you gave I would go with your second suggestion (which only works if you don’t need more nesting of the composables)
v

vide

02/17/2023, 5:17 PM
TIL! Thanks, I knew something like this must exist but wasn't sure what to search for. The example is of course a very naive simplification of the actual situation