data-flow
SwiftUI's actual mental model — view identity, lifetime, and dependencies (the Demystify canon), state ownership decision rules, Observation's per-property tracking, body-performance discipline, and the main-actor concurrency contract. Use when state resets mysteriously, views re-render too often, animations glitch between branches, choosing @State vs @Bindable vs plain property, or debugging "why did body run.
npx skills add rshankras/claude-code-apple-skills --skill data-flow --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# SwiftUI Data Flow Nearly every confusing SwiftUI bug — state that resets, animations that crossfade instead of move, lists that flash, bodies that run constantly — traces to identity, lifetime, or dependencies. This is Apple's own mental model (the Demystify sessions + Data Essentials + Observation), current through the WWDC26 `@State` macro. ## When This Skill Activates - "@State resets when…" / state loses its value on a condition change - Views re-render too often; animations crossfade when they should move - Lists flashing, rows reordering wrongly, `ForEach` misbehaving - Choosing between `@State`, `@Binding`, `@Bindable`, `@Environment`, plain property - Debugging with `Self._printChanges()`; concurrency warnings in view code ## Identity: the root concept SwiftUI sees three things: **identity, lifetime, dependencies**. Views with the same identity are "different states of the same conceptual UI element"; distinct identities are distinct views. - **Structural identity** = type + position in the hierarchy. An `if/else` creates **two identities** (`_ConditionalContent`) — flipping the branch destroys/recreates the view: state resets, transitions crossfade instead of animating.
- When This Skill Activates
- Identity: the root concept
- Lifetime: state is tied to identity
- ForEach identifier rules (the flashing-list checklist)
- Dependencies: the graph, not the tree
- State ownership: the decision rules
- Body discipline
- Concurrency contract (WWDC25)
- Output Format
- References
What does the data-flow skill do?
SwiftUI's actual mental model — view identity, lifetime, and dependencies (the Demystify canon), state ownership decision rules, Observation's per-property tracking, body-performance discipline, and the main-actor concurrency contract. Use when state resets mysteriously, views re-render too often, animations glitch between branches, choosing @State vs @Bindable vs plain property, or debugging "why did body run.
How do I install it?
Run `npx skills add rshankras/claude-code-apple-skills --skill data-flow --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From rshankras/claude-code-apple-skills, a repository with 589 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
