Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Covers SwiftUI's Layout protocol, Grid and lazy grids, custom containers, and lazy-stack and ScrollView performance and scrolling APIs.
86% 100%+14 ptsof test cases passed
Passed 22 of 22 test cases with the skill, and 19 of 22 without it.
I want to trigger an analytics log when a item in a LazyVStack becomes 80% visible. I attached `onScrollGeometryChange` to inspect absolute content offsets, but offset estimation in lazy stacks causes inaccurate triggers. Which scroll API should be used instead for tracking row visibility?
Recommends onScrollTargetVisibilityChange or onScrollVisibilityChange for visibility triggers
3 of 3 safety checks passed
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.
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) — use bounds.minX/midX (non-zero origins are
what make layouts composable); place(at:anchor:proposal:) with a proposal that may differ
from the ideal size (that's how equal widths happen).subviews[i].spacing.distance(to:along:), taking the larger
of conflicting preferences — matching built-in containers. No hardcoded 8s.LayoutValueKey (+ a layoutValue convenience modifier), read as
subview[Key.self].AnyLayout(HStackLayout()) ↔ custom layout with
.animation(_:value:) — SwiftUI sees one changing view, so state survives and it animates.ViewThatFits.| Need | Use |
|---|---|
| Static 2D with cross-row alignment | Grid/GridRow (+ gridCellColumns to span, gridColumnAlignment per column) |
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.