Erik
06/29/2022, 12:04 PMFoo
and you want to create a @Composable fun
to build some UI for Foo
instances. How would you name it?
• `Foo`: note that this is the same name as the Foo
class. This is not an error (if class and function are in different namespaces), but it could be confusing.
• FooView
• FooComposable
Something else? Are there guidelines for composable naming?curioustechizen
06/29/2022, 12:12 PMFooState
. Then the composable is just Foo
. But that's just me. I'm interested in how others approach this naming.Erik
06/29/2022, 12:19 PMFooItem
, FooRow
or FooColumn
when the composable is to be used in some list/grid/column/rowErik
06/29/2022, 12:19 PMFilip Wiesner
06/29/2022, 12:22 PMinvoke
operator function? 🤔 If you have instance of your Foo class, you would just call foo()
.Erik
06/29/2022, 12:29 PMErik
06/29/2022, 12:30 PMFilip Wiesner
06/29/2022, 12:40 PMSean McQuillan [G]
06/29/2022, 8:35 PMclass Foo / fun Foo
class FooState / fun Foo
In general, @Composable State.invoke()
is fine if weird, though if you do this be aware of the @Composable <=> class isomorphism
• remember = val prop
• remember { mutableState } = var prop w/ mutable state
• fun params = ctor argsSean McQuillan [G]
06/29/2022, 8:36 PM