SwiftUI hardening
Read references/runtime-hardening.md. Use for crashes, layout breakage, frozen/stale UI, hover/list defects, restoration surprises, hosting issues, or any “works in tests but fails live” report.
Workflow
- Reproduce on the exact macOS minor version, hardware class, window size/state, input method, and hosting context.
- Reduce to the smallest view/state transition while preserving the failure.
- Classify it: structural identity/transition, layout proposal/priority, observation/cache, list/table/scroll container, storage/restoration, focus/hover, or AppKit/SwiftUI hosting mismatch.
- Replace brittle composition with the simplest system-native invariant.
- Add a deterministic logic regression test where possible and a documented live-run scenario where not.
- Run repeated state changes, window resize/full-screen/tile changes, navigation and modal cycles, appearance, accessibility, focus, and lowest-supported-macOS checks.
- Record the failure mode and fix in a feature note if it is non-obvious.
Guardrails
- A passing unit suite is not a passing app; live-run non-trivial view changes.
- Do not turn one observed framework bug into a universal rule without macOS-version and hosting evidence.
- Prefer stable view identity and dimensional/modifier changes when structural insertion/removal destabilizes hosted layouts.
- Rebuild snapshot-derived caches from the canonical source after mutations.
- Treat
@SceneStorage/restoration defaults as persisted user state requiring migration.
- Hover-only actions must not reflow rows and need keyboard/menu alternatives.
Output
Report the macOS/hardware/window/input matrix, minimal trigger, classification, evidence, fix, regression protection, live-run results, and uncertainty about OS-specific behaviour.
1---2name: swiftui-hardening3description: Reproduce and harden macOS SwiftUI runtime, layout, hosting, list/table, state-restoration, stale-cache, focus, and hover failures that unit tests do not catch.4license: MIT5---67# SwiftUI hardening89Read `references/runtime-hardening.md`. Use for crashes, layout breakage, frozen/stale UI, hover/list defects, restoration surprises, hosting issues, or any “works in tests but fails live” report.1011## Workflow12131. Reproduce on the exact macOS minor version, hardware class, window size/state, input method, and hosting context.142. Reduce to the smallest view/state transition while preserving the failure.153. Classify it: structural identity/transition, layout proposal/priority, observation/cache, list/table/scroll container, storage/restoration, focus/hover, or AppKit/SwiftUI hosting mismatch.164. Replace brittle composition with the simplest system-native invariant.175. Add a deterministic logic regression test where possible and a documented live-run scenario where not.186. Run repeated state changes, window resize/full-screen/tile changes, navigation and modal cycles, appearance, accessibility, focus, and lowest-supported-macOS checks.197. Record the failure mode and fix in a feature note if it is non-obvious.2021## Guardrails2223- A passing unit suite is not a passing app; live-run non-trivial view changes.24- Do not turn one observed framework bug into a universal rule without macOS-version and hosting evidence.25- Prefer stable view identity and dimensional/modifier changes when structural insertion/removal destabilizes hosted layouts.26- Rebuild snapshot-derived caches from the canonical source after mutations.27- Treat `@SceneStorage`/restoration defaults as persisted user state requiring migration.28- Hover-only actions must not reflow rows and need keyboard/menu alternatives.2930## Output3132Report the macOS/hardware/window/input matrix, minimal trigger, classification, evidence, fix, regression protection, live-run results, and uncertainty about OS-specific behaviour.