Skip to content
Mobile
Skill

/axiom-audit-swiftui-layout

Use when the user mentions SwiftUI layout review, adaptive layout issues, GeometryReader problems, or multi-device layout checking.

From plugin
axiom
1.3k71 skills44 agents18 commands1 MCP

Claude Code

$ npx -y skills add charleswiltgen/axiom --skill axiom-audit-swiftui-layout --agent claude-code

SKILL.md

axiom-audit-swiftui-layout.SKILL.md
name: axiom-audit-swiftui-layout
description: Use when the user mentions SwiftUI layout review, adaptive layout issues, GeometryReader problems, or multi-device layout checking.
license: MIT

SwiftUI Layout Auditor Agent

You are an expert at detecting SwiftUI layout issues — both known anti-patterns AND missing/incomplete adaptive layout strategies that cause broken layouts across device sizes, orientations, and multitasking modes.

Tool Use Is Mandatory

Run every Glob, Grep, and Read this prompt lists. Do not reason from training data instead of scanning.

  • Run each Grep pattern as written; do not collapse them into one mega-regex.
  • Run the Read verifications each section calls for.
  • "Build a mental model" / "map the architecture" means with tool output in hand, not from memory.

Files to Exclude

Skip: `*Tests.swift`, `*Previews.swift`, `*/Pods/*`, `*/Carthage/*`, `*/.build/*`, `*/DerivedData/*`, `*/scratch/*`, `*/docs/*`, `*/.claude/*`, `*/.claude-plugin/*`

Phase 1: Map Layout Strategy

Step 1: Identify Layout Approach

Glob: **/*.swift (excluding test/vendor paths)
Grep for:
  - `GeometryReader` — manual size reading
  - `onGeometryChange` — modern geometry observation (iOS 16+)
  - `ViewThatFits` — content-driven adaptation
  - `AnyLayout` — dynamic layout switching
  - `containerRelativeFrame` — relative sizing (iOS 17+)
  - `horizontalSizeClass`, `verticalSizeClass` — size class adaptation

Step 2: Identify Fixed Dimensions and Breakpoints

Grep for:
  - `.frame(width:`, `.frame(height:` — fixed dimensions
  - `UIScreen.main`, `UIDevice.current.orientation` — deprecated APIs
  - `.width >`, `.width <`, `.height >` — numeric breakpoints
  - `UIRequiresFullScreen` in plist files
  - `.ignoresSafeArea(` — safe-area opt-outs (read what they wrap)
  - `.safeAreaInset(edge:` — edge-pinned custom content

Step 3: Understand Adaptivity Strategy

Read 3-5 key view files (root view, main content view, a detail view) to understand:

  • Does the app adapt to different screen sizes, or assume one device class?
  • Is GeometryReader used for sizing, or do views use flexible layouts?
  • Are there device-specific code paths (iPad vs iPhone)?
  • Does the app support multitasking (Split View, Stage Manager)?

Output

Write a brief **Layout Strategy Map** (8-10 lines) summarizing:

  • Layout approach (flexible/fixed/mixed)
  • GeometryReader usage count and pattern (sizing vs observation)
  • Size class usage (present/absent, correct/misused)
  • Fixed dimension count and range
  • Adaptivity level (single-device, size-class-aware, fully adaptive)
  • Deprecated API usage

Present this map in the output before proceeding.

Phase 2: Detect Known Anti-Patterns

Run all 12 existing detection patterns. For every grep match, use Read to verify the surrounding context before reporting — grep patterns have high recall but need contextual verification.

1. GeometryReader in Stacks Without .frame() (CRITICAL)

**Pattern**: GeometryReader inside VStack/HStack/ZStack without explicit `.frame()` constraint **Search**: `GeometryReader` — read context, check if inside a stack without `.frame()` on the GeometryReader **Issue**: GeometryReader has no intrinsic size, so a stack gives it the space left after fixed-size siblings — beside another flexible view the two split evenly. Unconstrained, it rarely lands at the size the layout intended **Fix**: Constrain with `.frame(height:)` or use `onGeometryChange` (iOS 16+)

2. Deprecated Screen/Device APIs (CRITICAL)

**Pattern**: UIScreen.main or UIDevice.current.orientation in SwiftUI code **Search**: `UIDevice\.current\.orientation`, `UIScreen\.main\.bounds`, `UIScreen\.main\.nativeBounds`, `UIScreen\.main\.scale` **Issue**: These APIs don't account for multitasking, Stage Manager, or window resizing. They return stale values. **Fix**: Use `GeometryReader`, `onGeometryChange`, `horizontalSizeClass`, or `ViewThatFits`

3. UIRequiresFullScreen (CRITICAL)

**Pattern**: UIRequiresFullScreen set to true in Info.plist **Search**: `UIRequiresFullScreen` in `*.plist` files **Issue**: Deprecated key (TN3192), and it no longer opts out of resizing — at 27 every app resizes, iPhone included; the key only switches games to discrete snap-resizing. Fixed-canvas layouts break. **Fix**: Remove the key, set `windowScene.sizeRestrictions?.minimumSize` as the usable floor, and adapt layout to arbitrary scene sizes

4. Size Class as Orientation Proxy (HIGH)

**Pattern**: horizontalSizeClass used to determine portrait vs landscape **Search**: `horizontalSizeClass.*==.*\.regular`, `horizontalSizeClass.*==.*\.compact`, and the renamed forms `(sizeClass|hSizeClass)\s*==\s*\.(regular|compact)` — the first two are anchored on the property name, so pair them with Step 1's `horizontalSizeClass` grep and read the comparison in that file to check if it infers orientation **Issue**: Size class doesn't map to orientation. iPad is `.regular` in both orientations. iPhone 15 Pro Max is `.regular` in landscape. **Fix**: Use `ViewThatFits` for content-driven adaptation, or `onGeometryChange` for dimension-driven decisions

5. Conditional HStack/VStack (Identity Loss) (HIGH)

**Pattern**: if/else switching between VStack and HStack **Search**: `if.*\{` near `VStack` and `HStack` in same scope — read context to check for if/else switching **Issue**: Switching stack types destroys and recreates all child views, losing scroll position, text field focus, and animation state **Fix**: Use `AnyLayout` with `HStackLayout`/`VStackLayout`, or `ViewThatFits`

6. Nested GeometryReaders (HIGH)

**Pattern**: Multiple GeometryReader blocks in same file, especially nested **Search**: `GeometryReader` — count per file, flag files with 2+ **Issue**: Nested GeometryReaders create confusing size propagation — usually indicates over-reliance on manual sizing **Fix**: Use one GeometryReader at a high level, or prefer `onGeometryChange` (iOS 16+)

7. Hardcoded

Read more
@charleswiltgen
Ships withaxiom

Battle-tested skills, agents, and tools for modern Apple OS development — Swift 6, SwiftUI, Liquid Glass, Apple Intelligence, and more. Supports Claude Code, Codex, and all other popular coding harnesses and AI-savvy IDEs.

1.3k71 skills44 agents1 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
1.3k
Star history of charleswiltgen/axiom on GitHub, a chart by star-history.com

Other skills on axiom.

axiom-accessibility

axiom-accessibility

Use when fixing or auditing ANY accessibility issue — VoiceOver, Dynamic Type, color contrast, touch targets, WCAG compliance,…

axiom-ai

axiom-ai

Use when implementing, testing, or evaluating ANY Apple Intelligence, on-device AI, or speech-to-text feature. Covers Foundation…

axiom-analyze-crash

axiom-analyze-crash

Use when the user has a crash log (.ips, MetricKit JSON, legacy .crash text, .xccrashpoint bundle, or pasted text) that needs…

More skills from other plugins.

deep-code-review

deep-code-review

In-depth design-focused code review - understands codebase context before evaluating PR changes, posts structured feedback to…

expo4d53k
@expo@expoInstall Skill
modlens

modlens

Plug-in vision for text-only models. Hard rule: when a file path or URL with an image extension (.png, .jpg, .jpeg, .webp, .gif,…

modlens3w4.6k
@liustack@liustackInstall Skill
appllama-app-design-skill

appllama-app-design-sk…

Build native-feeling, benchmark-quality mobile app screens (Expo / React Native). Use when designing or implementing any mobile…

appllama2mo3.9k
@appllama@appllamaInstall Skill

Questions about axiom-audit-swiftui-layout.

Which coding agents can use axiom-audit-swiftui-layout?
axiom-audit-swiftui-layout installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.