swiftui-interaction-footguns

Installation
SKILL.md

SwiftUI Interaction Footguns

A class of bugs that look fine in code but break at runtime. These have shipped to production from real projects (see Sightings section). Sweep this checklist on every SwiftUI View review.

When to invoke

  • Reviewing any new or modified SwiftUI View
  • Reviewing Button / NavigationLink / TabView / Form / Menu
  • Reviewing Mac variants (NavigationSplitView / sidebar)
  • After a macOS or iPad smoke test surfaces a tap or navigation bug
  • Before declaring a Phase complete that ships new View code

Checklist

Tap target & hit-test

  • Button { } label: { LayoutWithSpacer } .buttonStyle(.plain) → hit-test shrinks to drawn content; the Spacer-expanded area is not tappable. Fix: .contentShape(Rectangle()) on the label's outermost container.
  • Same trap for NavigationLink, Menu, and any custom interactive view with .onTapGesture + Spacer / frame(maxWidth: .infinity) / padding.
  • Padding and frame(maxWidth: .infinity) enlarge the visual frame but do not automatically enlarge the hit region under .plain. When in doubt, add .contentShape.
Installs
11
GitHub Stars
18
First Seen
Jul 6, 2026