Compose Multiplatform, one screen from state to pixels · check

Know One screen, two platforms already?

One question for each of the 4 puzzles in this module. A right answer marks that puzzle as passed, so you can jump ahead. A wrong one tells you which puzzle to start with. Nothing is sent anywhere: it's saved in this browser.

Puzzle 7: Who read the bookmark count?

A settings screen's top composable reads darkMode.value and passes the Boolean down three levels to a small switch row. darkMode flips. Which group does Compose mark?

Right. The read decides which group is marked.

Not quite. A write marks only the groups that read; the ones in between run only because their parent ran (or skip). Learn it in puzzle 7 →

Not quite. Compose follows where the read happened, not where the value ends up. Learn it in puzzle 7 →

Puzzle 8: Which work does a moving card need?

The card now also grows taller as you scroll, and its height follows the same position. Can placement alone handle that change?

Not quite. The offset lambda only moves the card; a height change has to be measured. Learn it in puzzle 8 →

Right. Size changes need measuring; position changes don't.

Not quite. Drawing paints what layout decided; it doesn't choose sizes. Learn it in puzzle 8 →

Puzzle 9: Which side hosts the other?

You delete the update parameter and keep editingChanged. The user types "lake", then taps Clear. What does the field show?

Right. State reaches the native view only through update.

Not quite. factory runs once, when the field first enters the composition. Learn it in puzzle 9 →

Not quite. Compose draws around the field; UIKit draws the field itself, and only update writes into it. Learn it in puzzle 9 →

Puzzle 10: Can VoiceOver understand the bookmark?

You keep the pointerInput version but give the Icon a content description, "Bookmark". VoiceOver focuses it. What can the user learn?

Not quite. An icon with a description gets a label and is read; it's the missing role and state that hurt here. Learn it in puzzle 10 →

Not quite. A label names an element; the role, the state and the action come from toggleable. Learn it in puzzle 10 →

Right. A label alone doesn't make a control.

Back to the overview →