Skip to content
✓ValidatedDec 2025 · 3 pressure scenarios passed What's this?

SwiftUI Adaptive Layout ​

Building layouts that respond to the space they're given rather than to assumptions about the device, and that keep the user's place when that space changes.

When to Use ​

Use this skill when you're:

  • Choosing between ViewThatFits, AnyLayout, onGeometryChange, and GeometryReader
  • Adapting one layout to iPhone, iPad, Split View, Stage Manager, or free-form windows
  • Relying on size classes that don't change when you expect
  • Supporting iPhone Duo's outer and inner displays, or a wide iPhone window
  • Losing scroll position, selection, focus, or a draft when a window resizes
  • Keeping content reachable in short windows, and text readable in wide ones
  • Changing layout for accessibility text sizes

Example Prompts ​

Questions you can ask your assistant that will draw from this skill:

  • "How do I make this layout work on iPad and iPhone?"
  • "Should I use GeometryReader or ViewThatFits?"
  • "My layout breaks in Split View and Stage Manager."
  • "Why does my iPad report a regular size class in portrait and landscape?"
  • "My designer wants a different layout for portrait and landscape."
  • "Should my iPhone app look like iPad in a wide window?"
  • "What size classes does iPhone Duo report on its outer and inner displays?"
  • "My scroll position is lost when the window resizes."
  • "My form's Confirm button is clipped when the window is short."
  • "Text lines are unreadably wide in a large window."

What This Skill Provides ​

Choosing a Tool ​

  • Decision trees for adapting to available space, platform traits, or window shape
  • What to use for each job, and what to avoid: ViewThatFits for variants, AnyLayout for animated switching, onGeometryChange for a measurement, and the Layout protocol for a custom algorithm
  • When GeometryReader is still necessary, and how to constrain it

Layout Patterns ​

  • A scroll view fallback for content that can't shrink
  • A readable width for text columns
  • Layout changes for large Dynamic Type sizes, and aspect ratio checks in place of orientation

Size Classes and Windows ​

  • Truth tables for iPad and iPhone Duo
  • Free-form iPad windows: the deprecated UIRequiresFullScreen, menu bar commands, automatic NavigationSplitView columns, and a migration checklist

Keeping State ​

  • Where each kind of state must live to survive a resize, from navigation paths to media playback
  • The trap of separate phone and tablet view trees that each own their state

Anti-Patterns and Pressure ​

  • Device orientation, screen bounds, and device model checks
  • Size class as a stand-in for orientation, and forcing .regular to imitate iPad on a wide iPhone
  • Pressure scenarios, such as "just use GeometryReader" and "we don't support iPad multitasking"

Documentation Scope ​

This page documents the layout skill (in the axiom-swiftui suite), which your assistant draws on when you design or repair an adaptive SwiftUI layout.

Resources ​

WWDC: 2022-10056, 2024-10074, 2025-208, 2026-278

Released under the MIT License