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.
npx skills add rshankras/claude-code-apple-skills --skill layout --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 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
- When This Skill Activates
- Custom Layout protocol (not GeometryReader)
- Grid decisions
- Custom containers (Demystify Containers)
- Lazy stacks & scrolling performance (WWDC26 rules)
- The scroll API map
- Output Format
- References
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.
