/iphone-duo-skills:iphone-duo-layoutfrom iphone-duo-skills
Fixes iOS app layouts on iPhone Duo's foldable display: multi-column adaptation, hinge-safe regions, reservedRegions API, ArrangementView, corner-aware margins, and camera occlusion handling.
Ships in iphone-duo-skills. 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.
Layout on iPhone Duo is ordinary adaptive layout pushed further: two displays with different size classes, a hinge that divides the inner display when folded, and cameras that occlude part of it. Start from system containers — most of the behavior comes for free — and add custom work only where a container cannot express it.
Code: references/layout-code.md. Availability: references/api-availability.md
(reserved regions, arrangements and ContentMarginGuide need the iOS 27.1 SDK,
which ships with Xcode 27.1 — on that toolchain they need a deployment-target gate,
not a blocked entry). Physical facts — display sizes, where the cameras and fold sit,
poses, drawing mockups: references/device-geometry.md (never a layout input).
Apple engineers' forum answers fill gaps the talks leave — collection views, web
views, sheets in folded poses — and rank below the talks
(references/sources.md › Developer Forums Q&A; cite them as Forums 848036).
horizontalSizeClass / verticalSizeClass (environment in
SwiftUI, trait collection in UIKit) and from the container size; never from
orientation or idiom (iphone-duo-adaptivity-audit owns removing those).references/device-geometry.md).safeAreaInsets numbers.
In UIKit, update in viewWillTransition(to:with:), viewSafeAreaInsetsDidChange()
and a trait-change registration.
In SwiftUI, read the size with onGeometryChange(for:of:action:),
not once in onAppear into @State.
Fold and unfold with each screen open (P7), not only at launch.references/device-geometry.md › Aspect-ratio consequences). Design that band
(controls, metadata, artwork) instead of leaving it black; it is a finding when a
player centers a 16:9 frame and hides everything else.DUO021).NavigationSplitView / UISplitViewController and TabView /
UITabBarController adapt across every pose: columns collapse when closed, tile
or overlay when open. List and ScrollView adapt to the fold.TabView { … }.defaultTabBarPlacement(.sidebar) /
tabBarController.sidebar.preferredPlacement = .sidebar. On iPhone this is an app
choice with no user toggle; the system shows the sidebar when space allows. Check
sidebar.isAvailable and surface sidebar-only destinations elsewhere when it is
not. (WWDC26 278, 9:18)presentationPlacement(.leading) / .trailing (UIKit
sheetPresentationController?.preferredPlacement, iOS 27.0) parks a sheet at an
edge so the content behind it stays visible; iphone-duo-bars owns what that
does to the sheet's toolbar.preferredPlacement from the
active division region in viewWillLayoutSubviews, which runs again on a fold
(references/layout-code.md › A sheet that follows the fold), and suggest an
enhancement request. Update custom detents on a size-class change only when the
content needs it, through registerForTraitChanges (Forums 848010)..fullScreen / fullScreenCover fills the app's own window scene, not the
display: in Split View it covers only the app's own side (Forums 847874).
.overCurrentContext applies only in regular width (Forums 847644).scripts/probes/side_inset_probe.swift): a centred 320 × 420 card
from a custom UIPresentationController got zero insets and verticalBarEdge
unspecified. With a navigation controller inside, the card kept its own bar
at its top, and the presenter's buttons stayed in the window's column.
A third-party report of content in a card that inherits the window's 84 pt inset
did not reproduce with this card.
Centre a card in the safe area, not in the window:
centred in the window, it sits 42 pt to the trailing side of the content beside it.UINavigationController app needs no new architecture: adapt the content inside
it, for example with a UIArrangementViewController as a pushed screen
(Forums 848055). Keep UISplitViewController for sidebar and content; an
arrangement does not replace it (Forums 848000).ignoresSafeArea() / view.bounds).DUO006); inset by all edges.
Test in Split View.ignoresSafeArea() puts content under the vertical bar (DUO014).
So do .all and .container with no edges:.
Keep the call on a background, artwork or full-bleed media layer.
For content, name only the edges it must reach.
The scanner skips a colour, gradient, image or media receiver,
the first view of a ZStack and a .background block.DUO015):
20, 44, 64, 88, 34, 49 and 83 pt, and topLayoutGuide / bottomLayoutGuide.
The bars move to the side (111462, 0:28), so pin to view.safeAreaLayoutGuide.
topLayoutGuide.bottomAnchor becomes safeAreaLayoutGuide.topAnchor;
topLayoutGuide.topAnchor becomes view.topAnchor, not the guide.
The scanner matches 20 and 44 only in a named bar height,
so check other 20 and 44 pt top offsets by hand.DUO016).
In Split View, screen coordinates differ from the view's
(keyboardFrameEndUserInfoKey documentation),
so a raw frame, or one converted with convert(_:from: nil), is wrong.
Constrain to view.keyboardLayoutGuide.
Where the frame itself is necessary, convert it with the screen's
coordinateSpace when it is used (references/layout-code.md).contentInsetAdjustmentBehavior = .never (DUO017) stops a scroll view from
adding the vertical bar's inset to its content.
Remove it unless the code insets the content itself at layout time.
Never add the safe area on top of adjustedContentInset.ReservedRegion / UIViewReservedRegion
(27.1, 8:08).ConcentricRectangle / UICornerConfiguration (iOS 26).
For controls placed against the margins, UIKit's
view.layoutGuide(for: .margins(cornerAdaptation: .horizontal)) (iOS 26, no gate)
moves them in from the rounded corners (Forums 848019). Booted: 16 pt on the
leading edge with .horizontal, on the top with .vertical; an edge the safe area
already insets does not change.safeAreaInsets and adjustedContentInset unchanged). Code that waits for an inset
to move a control off the fold waits forever: query the region.UIScrollView inside
another one reports a safe area of 0, because the outer one takes the 84 pt into
its adjustedContentInset (Booted). Inset a nested carousel from the outer
view's safe area. No scroll edge effect draws under the vertical bar
(iphone-duo-bars), so content that scrolls there needs a design decision.Design first (1:29–5:12):
Then query (6:39–7:50):
reservedRegions(kind: .division) on a GeometryProxy (via GeometryReader or
onGeometryChange) or on a UIView; use each region's frame.options: .includeInactive returns it anyway — use that for high-level decisions
such as preferring an even number of grid columns.
Decide with isActive, or with the default active-only query, never with
frame.width: the zero width is the fold line, while frame includes 20 pt of
margin each side and measures 40 pt flat and folded alike (Booted,
references/device-geometry.md).references/layout-code.md › Pose from the fold).verticalBarEdge;
so do tabletop and flat portrait. Only the fold region's isActive differs
(Booted, references/device-geometry.md › Sheets and pose pairs, measured)..includeInactive returns it even then (8:12; HIG › Reserved regions). The outer
camera's is always active and expands into the Dynamic Island for Live Activities.
On the outer display the same query also returns the bar strip beside it,
both with zero margins (Booted, references/device-geometry.md).frame (already including margins, the extra room
interactive content keeps), isActive, kind and id;
reservedRegions(kind:options:layoutDirectionBehavior:) returns every region that
intersects the view. (Apple documentation › ReservedRegion)Layout needs no special casing. Pass
layoutDirectionBehavior: .fixed only when you place content in absolute
coordinates on purpose. (Apple documentation › ReservedRegion)layoutSubviews / viewWillLayoutSubviews (SwiftUI: the geometry
reader); UIKit's observation tracking lays the view out again when they change.
Booted: the reading view got a pass on fold and on unfold, a sibling that did not
read them got none. Saving a fold state in sceneWillResignActive and restoring it
in sceneDidBecomeActive is a finding: the regions are current when the scene
returns, and a launch into a folded device needs no special path. Folding does not
call windowScene(_:didUpdateEffectiveGeometry:) (Booted).An arrangement is a layout container between navigation containers and content: it places a primary and a secondary view from size classes, aspect ratio and active division regions.
ArrangementView { primary } secondary: { secondary } inside a NavigationStack;
UIKit: UIArrangementViewController as the navigation controller's root with
setViewController(_:for: .primary / .secondary)..split.axes(.horizontal) restricts it; when it cannot split along its
allowed axis it shows only the primary view (12:44). UIKit:
updateArrangement(.split.axes(…)).
The hidden secondary stays in the hierarchy and is still laid out at full size —
its onGeometryChange fires — so never read visibility from its geometry
(Booted: .split.axes(.horizontal) on the portrait outer display).
In book pose the split moves its divider onto the fold, even against a
splitArrangementLayoutRatio, and leaves the fold's 40 pt frame empty between
the panes (Booted: 0.3 flat → 455.5 | 371.5 pt folded).overlayArrangementZIndex 1 against the secondary's 0 and sits at the top leading
corner at its own size (Booted, outer display). Respond to the z-index (UIKit:
state(for:)?.zIndex): the talk makes its collapsible Up Next list the primary
and collapses it while it floats over the player (13:44–14:17); the HIG also lets
you collapse the secondary when it should not appear. .overlay.axes(_:) limits
the axes it may go side by side along (SDK; UIKit UIOverlayArrangement.axes).
Folded like a book, the primary takes the trailing side of the fold and the
secondary the leading side, both at z-index 0, unless overlayArrangementEdge
says otherwise (Booted; Preparing your app for iPhone Duo › Arrange views).onAppear measurement — sees the unfolded one.primary or secondary closure reads the defaults — overlayArrangementZIndex
0, splitArrangementAxis nil — whatever modifiers it carries; a view nested
inside it, or the same view wrapped in a VStack, reads the real values. Apple's
own samples (the talk's UpNextView, the documentation's DetailsView) read at
that root, so copied as they are they never collapse or re-lay out.
(Booted, Xcode 27.1 (27A9269), outer display, the repository's
arrangement_probe.swift; the fix is in references/layout-code.md.)ArrangementView, UIArrangementViewController):
splitArrangementLayoutRatio(_:) sizes a view by a fraction of the container
(the view with the highest layoutPriority is sized first, the rest fill), or by
a range per axis with splitArrangementLayoutRatio(minHorizontal:idealHorizontal:…);
splitArrangementLayoutSize(minWidth:idealWidth:maxWidth:…) sizes it by points,
and splitArrangementFixedLayoutSize(horizontal:vertical:) also exists (SDK).
Read splitArrangementAxis from the environment, one view down, to re-lay out a
child for a horizontal or vertical split. overlayArrangementEdge(.trailing)
anchors an overlay's view when the fold turns the layers into a side-by-side
layout. UIKit: UISplitArrangement.DimensionRange, state(for:) →
ViewState.isHidden / splitAxis / zIndex, placement(for:),
updateArrangement(_:animated:). A UIKit ratio: copy the arrangement's
defaultViewProperties, set width.preferred = .fractional(0.3), write it back
with setViewProperties(_:for: .primary) on a var arrangement, then
updateArrangement(_:) (Forums 847990).HStack/VStack pattern → split; ZStack → overlay.
Without one: clear foreground/background relationship where partially covering
scrollable content is fine → overlay; main/detail where neither may be obscured →
split.
Not every two-column interface needs an arrangement:
a list → detail that is really navigation stays in NavigationSplitView,
which already adapts across displays.
An arrangement is for two views inside one destination.
(Follows from 111463 placing arrangements between navigation containers and
content, and from the rule below.)NavigationSplitView) inside an
arrangement, and don't put an arrangement inside List, ScrollView or any
container that could make part of it unreachable.Containers, List, ScrollView and system presentations adapt to the fold.
These do not, and the talks say nothing about them:
UICollectionView and compositional layouts
have no automatic fold avoidance. Scrolling grids need not avoid the fold — let them
scroll across it. Adjust only a section that does not scroll across the fold's axis
(a row of summary cards), from the collection view's own reserved regions, and
invalidate the layout when the fold changes (references/layout-code.md). Lining a
whole grid up with the fold is a refinement, not a requirement; the talk's Fitness
grid shows how (111463, 5:50). Hide content per size class in the data source or the
layout, never with a 0.1 pt section (Forums 848018).env(safe-area-inset-*) and the web view's
content insets do not include the fold, and the Viewport Segments and Device
Posture APIs cannot be enabled in WKWebView — they are experimental Safari flags
(Forums 847644; Booted: all three unavailable). For a page the app controls,
query the regions in the host and pass them in as CSS custom properties, separate
from the safe-area insets. A page the app does not control keeps scrolling across
the fold; keep native controls that float over it clear of the fold.UITabAccessory from the
division region when partially folded (Forums 847814)..occlusion and keep controls out of it.compositional layout in the inventory) and
web content (web views).references/recommendation-format.md), marking 27.1 APIs blocked when
the SDK lacks them; apply after approval; build.references/pose-test-matrix.md.
scripts/duo_pose.py shoot reaches P1, P5 and P3 from a script (third-party
hinge CLI; ask first): look in the book-pose screenshot for anything that sits
on the fold. P6 needs rotation, which only Device Hub does.onHingeChange / UIHingeInteraction report the live angle for interactions and
effects. For layout use arrangements and reserved regions. (Tech Talk 111464, 2:35)
evals/evals.json (opens in a new tab)evals/files/ArticleWeb/ArticleWeb/ArticleViewController.swift (opens in a new tab)evals/files/ArticleWeb/Web/article.css (opens in a new tab)evals/files/AudioNotes/AudioNotes/PlayerScreen.swift (opens in a new tab)evals/files/Cinema/Cinema/PlayerScreen.swift (opens in a new tab)evals/files/Dashboard/Dashboard/DashboardViewController.swift (opens in a new tab)evals/files/Episode/Episode/EpisodeScreen.swift (opens in a new tab)evals/files/LiveDot/LiveDot/LiveIndicator.swift (opens in a new tab)evals/files/MapSearch/MapSearch/SearchScreen.swift (opens in a new tab)evals/files/NoteDeck/NoteDeck/ComposeViewController.swift (opens in a new tab)evals/files/NoteDeck/NoteDeck/Info.plist (opens in a new tab)evals/files/NoteDeck/NoteDeck/NoteDeckApp.swift (opens in a new tab)evals/files/NoteDeck/NoteDeck/NoteListView.swift (opens in a new tab)evals/files/NotesSplit/NotesSplit/EditorScreen.swift (opens in a new tab)evals/files/PhotoWall/PhotoWall/GalleryGrid.swift (opens in a new tab)evals/files/ReaderApp/Reader/ArticleScreen.swift (opens in a new tab)evals/files/ReaderApp/Reader/LibraryScreen.swift (opens in a new tab)evals/files/TripMap/TripMap/MapViewController.swift (opens in a new tab)evals/files/VoiceMemo/VoiceMemo/RecordScreen.swift (opens in a new tab)evals/trigger-evals.json (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
iphone-duo, foldable-layout, swiftui, uikit, adaptive-layout
5 skills in this plugin
/iphone-duo-adaptivity-auditFind and fix legacy screen, orientation, idiom and lifecycle code that breaks on iPhone Duo's inner display and in other iOS 27 resizable environments (iPhone Mirroring, iPhone apps on iPad, Split View). Use when a developer asks about UIScreen.main or mainScreen, screen bounds or scale, interfaceOrientation or UIDevice orientation checks, userInterfaceIdiom layout forks, keyWindow or connectedScenes.first, migrating from app lifecycle to UIScene lifecycle (required with the latest SDK), UIRequiresFullScreen, a missing launch screen (ITMS-90870), portrait-only apps, or hard-coded Face ID strings and symbols (iPhone Duo has Touch ID; branch on LAContext.biometryType). Covers SwiftUI and UIKit, ships a read-only scanner, and delegates bulk UIKit rewrites to Xcode's own modernization skill when available. Not for app features that merely touch UIScreen or orientation, such as screen brightness, deliberately locking a game to one orientation, or camera and sensor setup./iphone-duo-barsPrepare navigation bars, toolbars and tab bars for iPhone Duo's vertical bars, where controls move to the side of the outer display and of the inner display in landscape. Use when a developer asks about vertical bars, bar item ordering, back, custom back or close button placement, pinned trailing or prominent actions, toolbar items without titles, axisBehavior, symbol-only items and badges, custom views in toolbars, toolbarVerticalEdge or verticalBarEdge, overflow menus and ToolbarOverflowMenu, visibilityPriority, toolbar or tab bar compression, custom UIToolbar or UINavigationBar instances, hand-built tab bars or bars that must stay custom, sheet toolbars and presentationPlacement, backgrounds under the bar with backgroundExtensionEffect, or opting out with toolbarVerticalBehavior. Covers SwiftUI and UIKit, based on Apple's "Raise the bar with iPhone Duo", "Preparing your app for iPhone Duo" and Apple engineers' forum answers.Other plugins' skills for the same job
npx claudepluginhub alexey1312/iphone-duo-agent-skill --plugin iphone-duo-skills