~/talk

Composing an API the *right* way

Talkat droidcon Berlin 2024 · 2024-07-03..07-05· [api-design]
slides:none on file

Summary of actionable rules from the AndroidX Compose guidelines and JetBrains Compose Multiplatform details: use camelCase for constant-like objects and nouns with uppercase for UI-emitting composables, distinguish emitter vs value-returning functions, make components return unit and emit exactly one root node, avoid returning or accepting mutable State — take plain values and callbacks instead, prefer explicit parameters over composition locals for non-global data, expose a Modifier default = Modifier as the first optional param and apply it to the root, collect many defaults into public objects, use slot APIs and movableContentOf to preserve content across branches, put the primary slot content last, and enforce rules with kotlin lint/detekt checks.

AI-written summary · about

  1. 0:00API design in Compose
  2. 1:26Constants conventions in Compose
  3. 3:56Naming Composable functions
  4. 6:46Composable components
  5. 8:51Components return Unit
  6. 10:57Parameters vs CompositionLocals
  7. 13:03Default arguments
  8. 16:13Modifiers in Compose
  9. 18:21Modifier parameters
  10. 21:50Chaining Modifiers
  11. 23:15Slot APIs
  12. 26:24Slot content lifecycle
  13. 28:30Parameter ordering
  14. 31:45State handling
  15. 34:34Stakeholders for state
  16. 37:44Framework vs app code
  17. 38:27Tooling for Compose
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.