Is it too early to start talking about a compose style guide? Or should I check back in 6 months? 🧌
s
sindrenm
12/09/2019, 11:53 AM
It's never to early to start talking about it, IMO, but it might also change a fair amount in the future. 😉
e
efemoney
12/09/2019, 12:06 PM
Yeah that's totally understandable. A style guide will evolve to match. Only mentioning it because the compose snippets I see looks like the wild west now in terms of style.
👍 1
a
Adam Powell
12/09/2019, 1:39 PM
What are you thinking about in particular?
e
efemoney
12/10/2019, 3:21 PM
Normal kotlin codestyles might not work for instance I’ve noticed putting
) {
on its own line in compose adds a lot of noise so it should be put in front of the last argument on the same line like
text = "Stuff") {
, also attributes (method arguments) should be on same line if short or each attribute on their own line with indent 2, while children (within the lambdas) should have indent 4 (or attribute indent x2)
In actuality, the post above was a troll post but this is what I was thinking at the time
efemoney
12/10/2019, 3:25 PM
And style can get away with putting attributes and children on the same indent level (2) because children are discernable from method arguments with their names being capitalized and probably separated by a blank line.