Agent skill · Data & Analytics

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.

rshankrasgithub.com/rshankrasGitHub ↗
claude-codecan modify filesMIT
Install
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.

Facts
Files in the skill folder: 1
SKILL.md size: 8 KB
Bundled scripts: none
Allowed tools: ReadWriteEditGlobGrep
Path: skills/swiftui/data-flow/SKILL.md
Open the folder on GitHub →
Where it comes from
Stars: 589
Language: Swift

Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.

From the SKILL.md

# 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.

What's inside
Steps it walks through
  1. When This Skill Activates
  2. Identity: the root concept
  3. Lifetime: state is tied to identity
  4. ForEach identifier rules (the flashing-list checklist)
  5. Dependencies: the graph, not the tree
  6. State ownership: the decision rules
  7. Body discipline
  8. Concurrency contract (WWDC25)
  9. Output Format
  10. References
More from claude-code-apple-skills
All skills →
About this skill
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.

Keep going