/duology-design:duo-patternsfrom duology-design
Picks and builds SwiftUI layout patterns for iPhone Duo, Apple's foldable iPhone. Covers list-detail, supporting pane, two-page, dual view, extended canvas, feed reflow with even columns, tabs to sidebar, and displacement off the fold.
Ships in duology-design. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Use this skill to choose a layout pattern for a screen on iPhone Duo, then build it. Every pattern has a reference file with when to use it, closed and open behaviour, the Apple APIs, rules, pitfalls, a SwiftUI recipe that typechecks against the iOS 27.1 SDK, and a screen in the Duology gallery app.
Read the reference for the pattern you pick before you write code. For bars and toolbars, load duo-navigation. For size classes, safe areas and UIKit layout depth, load duo-layout. For keeping state through a fold, load duo-continuity.
NavigationSplitView, TabView, NavigationStack, sheets, alerts, menus and toolbar buttons already adapt to the fold (hub, talk 111463).ArrangementView inside a NavigationStack or a tab. Never put a navigation container inside an arrangement, and never put an arrangement inside a List or ScrollView. Don't nest it with a NavigationSplitView either way; Apple's pages disagree on that case, so see Combining patterns (talk 111463, HIG, hub).onHingeChange) for effects only (talk 111464).UIScreen.main, userInterfaceIdiom, interface orientation or fixed sizes (prepare page).| Input | API | Use it for |
|---|---|---|
| Width class | @Environment(\.horizontalSizeClass) | One pane or two |
| The view's own size and shape | onGeometryChange(for:of:action:) | Wide or tall, column count |
| The fold | reservedRegions(kind: .division, options:) (iOS 27.1) | Where to split, where controls may not go |
| Cameras and the status bar corner | reservedRegions(kind: .occlusion, options:) | Keeping controls clear |
| System margins, per side | contentMargins(for: .container, edges:) (iOS 27.1) | Asymmetric margins next to a vertical bar |
| Is a tab sidebar available | isTabViewSidebarAvailable (iOS 27.0) | Hiding shortcuts the sidebar repeats |
Answer in order. The first yes is the screen's main pattern. If a later question is also a yes, read Combining patterns.
EvenSplit or FoldSplitLayout from duo-layout, and duo-shared-screen. A split arrangement can drop to its primary view alone, for example on the closed phone held sideways."Partly folded" means folded like a book, the fold running top to bottom.
| Pattern | Closed (outer) | Open, flat | Partly folded | Build with | Reference | Gallery screen |
|---|---|---|---|---|---|---|
| List-detail | List, then detail | Both, list narrower | 50/50 at the fold, by the system, while columnVisibility is .all | NavigationSplitView with columnVisibility | list-detail.md | ListDetailView |
| Supporting pane | Main content; pane in a sheet | Main plus a narrower pane | One per side | ArrangementView, .split.axes(.horizontal) | supporting-pane.md | SupportingPaneView |
| Two-page | One page | Two pages, gap on the fold line | One page per side | Custom split from the .division region | two-page.md | TwoPageView |
| Dual view | One view and a switch | Both views, in sync | One per side | ArrangementView split, shared model | dual-view.md | DualView |
| Extended canvas | Canvas | Canvas across the fold | Canvas across; tools move to one side | Full-size view, tools placed from .division | extended-canvas.md | ExtendedCanvasView |
| Feed reflow | As many columns as fit | Even column count | Half the columns per side, fold as the gap | LazyVGrid, .division with .includeInactive | feed-reflow.md | FeedReflowView |
| Tabs to sidebar | Tab bar on the side | Sidebar | Sidebar (not measured folded) | TabView, .sidebarAdaptable, .defaultTabBarPlacement(.sidebar) | tabs-to-sidebar.md | TabsToSidebarView |
| Displacement | Unchanged | Unchanged | Controls move to the trailing region; content stays | .division region, active only | displacement.md | DisplacementView |
Folded across instead (the phone held tall and set on a table like a laptop), the regions are top and bottom: content to look at goes up, controls go down (talk 111463).
Most screens need one pattern. When two questions above get a yes, combine them like this:
| Screen | Build it like this |
|---|---|
| Tabs plus any pattern | The pattern goes inside each tab. Prefer a NavigationStack in a tab; a NavigationSplitView there adds a second leading column (tabs-to-sidebar.md). |
| List-detail plus a side pane (a notes list, the note, a summary pane) | NavigationSplitView, with inspector(isPresented:content:) on the detail column. Recipe below. |
| Supporting pane or dual view with navigation | NavigationStack { ArrangementView { … } }, also inside a tab. The recipes in supporting-pane.md and dual-view.md already do this. |
| Any pattern plus your own centred controls | Add displacement to those controls only. |
Split views and arrangements: the talk and the HIG say navigation containers, split views included, go around an arrangement, not inside it. The hub says to avoid an arrangement inside a navigation split view, because part of it can become unreachable. Follow the stricter hub rule, as duo-navigation does: never nest an ArrangementView with a NavigationSplitView in either direction. For a pane beside list-detail, use an inspector. It is a system container, so it needs no arrangement.
import SwiftUI
// requires: Note, NoteDetail (references/list-detail.md)
struct NotesWithSummary: View {
let notes: [Note]
@SceneStorage("notes.selection") private var selection: Note.ID?
@SceneStorage("notes.showsSummary") private var showsSummary = false
// Same rule as list-detail.md: both columns when wide, the note alone when tall.
@State private var columnVisibility = NavigationSplitViewVisibility.all
@State private var isWide = true
var body: some View {
NavigationSplitView(columnVisibility: $columnVisibility) {
List(notes, selection: $selection) { Text($0.title) }
.navigationTitle("Notes")
} detail: {
if let note = notes.first(where: { $0.id == selection }) {
NoteDetail(note: note)
.toolbar {
ToolbarItem {
Button("Summary", systemImage: "sparkles") { showsSummary.toggle() }
}
}
// Open: a trailing column. Closed: a sheet. Same view, same state.
.inspector(isPresented: $showsSummary) {
Text("Summary of \(note.title)")
.inspectorColumnWidth(min: 240, ideal: 300, max: 360)
}
} else {
ContentUnavailableView("No Note Selected", systemImage: "note.text")
}
}
.onGeometryChange(for: Bool.self) { $0.size.width > $0.size.height } action: {
isWide = $0
columnVisibility = isWide || selection == nil ? .all : .detailOnly
}
.onChange(of: selection) {
columnVisibility = isWide || selection == nil ? .all : .detailOnly
}
}
}
Apple's inspector doc promises a trailing column at regular width and a sheet at compact width. Measured on the closed simulator (382 pt wide, compact): the pane came up at 374 × 636 pt over a full-width detail, whether the inspector sat on the detail column or on the whole split view. Open, the list, the note and the pane share the inner display; check in Device Hub that the note keeps a usable width. (unverified open and folded)
Three recipes (two-page, extended canvas, displacement) use this helper. Add it to the app once. It typechecks against the iOS 27.1 simulator SDK in Swift 5 and Swift 6 mode, with an iOS 26 deployment target, and with a new Xcode 27.1 app's settings (SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor, approachable concurrency). Keep nonisolated: without it, that setting makes the struct's Equatable conformance main-actor isolated, and onGeometryChange rejects it.
import SwiftUI
/// Where the fold crosses a view, read from the view's reserved regions.
/// Layout input only. Never drive layout from the hinge angle.
@available(iOS 27.1, *)
nonisolated struct FoldGeometry: Equatable, Sendable {
/// The fold's frame in this view's space, margins included. Nil when no fold crosses the view.
var frame: CGRect?
/// True while the phone is partly folded. False when it lies flat.
var isActive = false
/// True when the fold runs top to bottom, so the view has a left half and a right half.
var isVertical: Bool {
guard let frame else { return false }
return frame.height > frame.width
}
init(frame: CGRect? = nil, isActive: Bool = false) {
self.frame = frame
self.isActive = isActive
}
init(_ proxy: GeometryProxy) {
// The default query returns active regions only. Ask for inactive ones too,
// so a flat inner display still tells you where its fold is. Keep only a
// fold with part of this view on each side of it.
let size = proxy.size
let folds = proxy.reservedRegions(kind: .division, options: .includeInactive)
.filter { Self.liesInside($0.frame, of: size) }
if let fold = folds.first(where: \.isActive) ?? folds.first {
frame = fold.frame
isActive = fold.isActive
}
}
/// True when a fold frame splits a view of `size` into two non-empty parts.
/// A region query can return regions that lie outside the view (`duo-postures`).
static func liesInside(_ frame: CGRect, of size: CGSize) -> Bool {
if frame.height > frame.width {
return frame.minX > 0 && frame.maxX < size.width
}
return frame.minY > 0 && frame.maxY < size.height
}
}
@available(iOS 27.1, *)
extension View {
/// Calls `action` with the fold geometry now and every time it changes.
func onFoldChange(_ action: @escaping (FoldGeometry) -> Void) -> some View {
onGeometryChange(for: FoldGeometry.self) { proxy in
FoldGeometry(proxy)
} action: { fold in
action(fold)
}
}
}
Use it: @State private var fold = FoldGeometry(), then .onFoldChange { fold = $0 } on the view whose space you lay out in. Region frames come back in that view's coordinates, mirrored for right-to-left by default. Don't attach it inside a scroll view's content unless you store only x values; see feed-reflow.md.
iOS 27.1 iPhone Duo simulator, open, flat, held wide (951 × 669 pt), Xcode 27.1, 16 Oct 2026:
.division query returned nothing. With .includeInactive it returned one inactive fold: a 40 pt frame, centred, full height, with 20 pt margins each side. Talk 111463 says the default is "active only"; Apple's ReservedRegion page says the opposite. The simulator agrees with the talk..occlusion query returned one active 84 × 124 pt region in the top trailing corner, where the status bar sits. .includeInactive added a 58 × 37 pt inactive one, likely the inner camera (our reading).onAppear was empty. Values came with the next geometry update..division region turned active and stayed in place, 40 × 669 pt at (455, 0), top to bottom. Partly folded and held tall (tabletop), it ran across: active, 669 × 40 pt at (0, 455). The overlay prints y = 17 held wide because its own view starts 17 pt above the display. Details in two-page.md.From Apple's hub, HIG, ArrangementView and talk 111463:
.automatic, resolves to .split..split.axes(.horizontal) forbids stacking; if it can't split, it shows only the primary.splitArrangementLayoutRatio or splitArrangementLayoutSize, never fixed widths.Measured on the simulator, open and flat:
.split.axes(.horizontal) in a frame taller than wide showed only the primary. The secondary still ran onAppear and got the full size. No API told us it was hidden.splitArrangementAxis read nil and overlayArrangementZIndex read 0 in the views passed to the arrangement, full screen and in frames: those views get the defaults. Read both one view down (duo-layout). There, overlayArrangementZIndex in the primary read 1 closed and open flat and 0 in book and tabletop (measured in duo-media). splitArrangementAxis folded is unverified.| Pattern | UIKit |
|---|---|
| List-detail | UISplitViewController |
| Supporting pane, dual view | UIArrangementViewController, setViewController(_:for:), updateArrangement(.split.axes(.horizontal)) |
| Tabs to sidebar | tabBarController.mode = .tabSidebar plus tabBarController.sidebar.preferredPlacement = .sidebar (iOS 27.0). Measured: preferredPlacement alone gave no sidebar. |
| Two-page, extended canvas, feed reflow, displacement | UIView.reservedRegions(kind:options:) with .division and .includeInactive (iOS 27.1) |
We found no change callback for reserved regions in the UIKit headers. Re-query them in layoutSubviews and check in Device Hub that a fold triggers it. (unverified)
Duology's pattern names come from earlier foldables. Their guidance describes other hardware: treat it as ideas to test, not rules for iPhone Duo.
Every source with its check date: reference/sources.md. Every API with its availability: reference/api-index.md.
UIScreen.main, hinge angle or fixed screen sizes.ArrangementView inside a List, a ScrollView or a NavigationSplitView column, and no navigation container inside an arrangement. A pane beside list-detail is an inspector.onGeometryChange are nonisolated when the target uses main actor default isolation.@available or if #available when the app supports iOS 26.references/displacement.md (opens in a new tab)references/dual-view.md (opens in a new tab)references/extended-canvas.md (opens in a new tab)references/feed-reflow.md (opens in a new tab)references/list-detail.md (opens in a new tab)references/supporting-pane.md (opens in a new tab)references/tabs-to-sidebar.md (opens in a new tab)references/two-page.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
iphone-duo, foldable, swiftui-layout, duo-patterns, adaptive-layout
8 skills in this plugin
/duo-accessibilityMakes iPhone Duo apps work with VoiceOver, Dynamic Type, Reduce Motion, Increase Contrast, hardware keyboards, Switch Control and Voice Control on both displays. Use it when VoiceOver reads two panes row by row or loses its place after the phone folds or unfolds, when text truncates or clips on the 5.4-inch outer display at large text sizes, when a hinge effect or resize animation ignores Reduce Motion, when colours fail contrast, when keyboard shortcuts or focus don't work, or when you add accessibility labels, identifiers or audits. Covers accessibilityElement(children: .contain), accessibilitySortPriority, AccessibilityFocusState with a delayed move after a size-class change, AnyLayout and ViewThatFits reflow with isAccessibilitySize, ScaledMetric, accessibilityReduceMotion with onHingeChange, colorSchemeContrast, keyboardShortcut, accessibilityInputLabels, modifiers before .position, Accessibility Inspector, performAccessibilityAudit and XCUIDevice voiceOverService UI tests on the iPhone Duo simulator./duo-design-reviewReviews screenshots, simulator captures and Figma frames for iPhone Duo, Apple's foldable, against a 15-point checklist (letterboxing, state lost on fold and unfold, sizing from UIScreen.main, text or buttons in the fold via reservedRegions .division and .occlusion, odd grid columns, vertical toolbars with symbols and titles, tabletop and book layouts with ArrangementView overlay, camera preview rotation, outer display feature parity, multiple windows with UIWindowScene.ActivationAction, transitions, 44 pt touch targets, hardware keyboard, drag and drop) and writes findings with severity, rule, where and fix. Use it when someone asks to critique, audit or review a design, mockup, concept or Dribbble shot for the foldable, the outer display or the inner display, or asks what breaks when the phone is closed, open, partly folded like a book, propped on a table, in Split View or under Picture in Picture./duo-design-systemDesign tokens and a drop-in SwiftUI token module for iPhone Duo, Apple's foldable, that adapt by size class instead of by device. Covers a 4-point spacing scale, system margins and gutters with a wider gap at the fold, even-column layout grids (4 compact, 8 regular) with spans, one type scale with Dynamic Type for the 5.4-inch outer and 7.6-inch inner display, Liquid Glass usage and legibility (glassEffect, GlassEffectContainer, regular vs clear, dimming, tint), ConcentricRectangle and containerShape for corners, 44 pt touch targets, and light, dark and Increase Contrast colours with a contrast check. Use when you set up spacing, grids, fonts, corners, glass or colours, build a design system, theme or tokens for an iPhone Duo app, or turn a two-frame Figma design into code./duo-ergonomicsPuts controls where hands can reach them on iPhone Duo, Apple's foldable iPhone: one-handed on the closed phone, two hands on the open display, the book grip, and hands-free on a table. Use it when you decide where a primary action, a floating button, player controls or a custom control strip goes; when buttons sit at the top centre of the open display, on the fold or out of thumb reach; when you check thumb zones or reachability; when you design for left-handed people or right-to-left languages; or when touch targets are small. Covers why bars move to the side edge, toolbarVerticalEdge and verticalBarEdge (read them; right to left changes the name, not the side), visibilityPriority for bottom-bar actions, a ThumbCorner modifier for floating controls, an in-app hand preference, ArrangementView with the overlay style to put controls in the bottom half, reservedRegions(kind: .division) to keep targets off the fold, and 44 pt hit regions with frame(minWidth:minHeight:) and contentShape on the label./duo-posturesDesigns iPhone Duo screens for every pose Apple shows: closed on the outer display, open flat (wide or tall), partly folded like a book, propped on a table like a laptop (tabletop), standing like a tent, and open and turned around (flipped, rear cameras facing the user). Use it when a screen must work half folded, when you build a tabletop media player or video call (video on top, the same controls below the fold), a book-pose layout with two regions, or a hinge effect. There is no posture API: read size classes and the .division reserved region (active only when partly folded) with FoldGeometry and FoldRegionsLayout, and keep onHingeChange and UIHingeInteraction for effects, with Reduce Motion and accessibility rules./duo-shared-screenBuilds screens that two people use at the same time on one iPhone Duo, Apple's foldable iPhone - two-player games, teaching, showing a customer, kid and parent. Use when two people share the inner display or the outer display, sit side by side or face to face across a phone lying flat, or when you need one half per person (SharedSplit, an EvenSplit with seating, not ArrangementView), per-half named coordinate spaces and contentShape, DragGesture minimumDistance with onTapGesture, input gated per seat, one-sided destructive controls, sensoryFeedback per half, persistentSystemOverlays and defersSystemGestures during play, rotationEffect to turn a half for face-to-face use, accessibility per half, and XCUITest identifiers namespaced by seat.npx claudepluginhub kimeur/duology --plugin duology-designOther plugins' skills for the same job