Agent skill · Design & Presentation

layout

SwiftUI layout beyond stacks — the Layout protocol (when custom layout beats GeometryReader), Grid vs lazy grids, custom containers with sections and container values, and lazy-stack/ScrollView performance rules (what breaks laziness, prefetch discipline, scroll APIs). Use when building custom layouts or containers, fixing lazy-stack jank or memory growth, or wiring programmatic/snapping scrolling.

rshankrasgithub.com/rshankrasGitHub ↗
claude-codecan modify filesMIT
Install
npx skills add rshankras/claude-code-apple-skills --skill layout --agent claude-code

Same command for any agent — swap --agent for codex, cursor, copilot.

Facts
Files in the skill folder: 1
SKILL.md size: 7 KB
Bundled scripts: none
Allowed tools: ReadWriteEditGlobGrep
Path: skills/swiftui/layout/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 Layout & Containers The layer between "stacks and spacers" and "it scrolls like butter with 100k rows" — Apple's Layout protocol, container composition, and the lazy-stack rules from the WWDC26 deep dive. View identity/data-flow questions route to `swiftui/data-flow`. ## When This Skill Activates - "Make these buttons equal width" / measurement-dependent layout - Building a reusable container (custom List/board/carousel) that should accept ForEach + sections - Lazy stack jank, memory growth, scroll-position bugs, broken scroll targeting - Programmatic scrolling, paging/snapping, scroll-linked effects - GeometryReader causing layout loops or mangled sizing ## Custom Layout protocol (not GeometryReader) Reach for a custom `Layout` whenever you must **measure subviews and feed the measurement back into layout** — GeometryReader only measures its container and can't influence the engine. Canonical case: equal-width buttons. - `sizeThatFits`: propose `.unspecified` to read each subview's ideal size (`subviews.map { $0.sizeThatFits(.unspecified) }`); guard empty subviews; `replacingUnspecifiedDimensions()` for nil proposal dimensions. - `placeSubviews`: never assume origin (0,0

What's inside
Steps it walks through
  1. When This Skill Activates
  2. Custom Layout protocol (not GeometryReader)
  3. Grid decisions
  4. Custom containers (Demystify Containers)
  5. Lazy stacks & scrolling performance (WWDC26 rules)
  6. The scroll API map
  7. Output Format
  8. References
More from claude-code-apple-skills
All skills →
About this skill
What does the layout skill do?

SwiftUI layout beyond stacks — the Layout protocol (when custom layout beats GeometryReader), Grid vs lazy grids, custom containers with sections and container values, and lazy-stack/ScrollView performance rules (what breaks laziness, prefetch discipline, scroll APIs). Use when building custom layouts or containers, fixing lazy-stack jank or memory growth, or wiring programmatic/snapping scrolling.

How do I install it?

Run `npx skills add rshankras/claude-code-apple-skills --skill layout --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