published fresh until

How do I get my agent to build SwiftUI list and detail screens?

Summary As of November 2026, swiftui-expert-skill covers stable ForEach identity, width-aware NavigationSplitView, item-driven sheets and empty states. NavigationSplitView needs iOS 16+; ContentUnavailableView needs iOS 17+

Not for SwiftUI keyboard and chat-bar layout; see swiftui-chat-input-bar-list-wont-scroll-with-keyboard-safeareabar-ios-26

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

As of November 2026, use stable list identity and NavigationSplitView with selection that survives width changes. Do first: read the skill’s list and navigation references; choose compact or multi-column behavior from the available space.

The problem

SwiftUI list-to-detail screens written by agents go wrong in quiet ways: unstable ForEach identity that crashes on delete, old NavigationLink(destination:) mixed with newer navigation, and phone-only layouts that do not adapt on iPad.

What the source says

AvdLee/SwiftUI-Agent-Skill (MIT) ships swiftui-expert-skill with a topic router. Two references apply:

  • list-patterns: always give ForEach stable identity (use Identifiable or a key path); never .indices for dynamic content (it can crash on removal); keep a constant number of views per element; plus patterns for pull-to-refresh and ContentUnavailableView empty states (iOS 17+).
  • sheet-navigation-patterns: type-safe navigation with NavigationStack and navigationDestination(for:), programmatic navigation with a path, item-driven sheets (sheet(item:)), and NavigationSplitView with two or three columns using List(selection:). It is available on iOS 16+. The current navigation reference makes width the boundary: compact contexts collapse, regular contexts can show columns even on an iPhone. Do not select the layout from the device family alone.

How to describe it to the agent

Use the swiftui-expert-skill. Build a Recipes list and detail screen. Model has a stable id and conforms to Identifiable. Use NavigationSplitView with List(selection:) so it shows columns when space permits and collapses at compact width. Keep selection consistent as the available width changes. Use navigationDestination(for:) and no NavigationLink(destination:). Add pull-to-refresh and ContentUnavailableView for empty and no-results. Editing opens through sheet(item:). Gate anything newer than my deployment target with #available.

Mistakes to check

  • ForEach(items.indices, ...) or id: \.self on non-stable values.
  • Old and new navigation APIs mixed.
  • An empty list showing a blank screen.
  • The skill says to adopt Liquid Glass only when asked; do not let the agent add it unprompted.

Limits

Availability still matters: NavigationSplitView needs iOS 16+, while ContentUnavailableView needs iOS 17+. Use fallbacks for older deployment targets (navigation, lists).

Sources

Started from a post by @Antoine van der Lee, packaged by the editor. Original post

Subjects

More in agent skills

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# How do I get my agent to build SwiftUI list and detail screens?
Summary: As of November 2026, swiftui-expert-skill covers stable ForEach identity, width-aware NavigationSplitView, item-driven sheets and empty states. NavigationSplitView needs iOS 16+; ContentUnavailableView needs `iOS 17+`
Copy for agent
get the whatworks thread swiftui-list-detail-navigationsplitview and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread swiftui-list-detail-navigationsplitview
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks