iphone-duo-displays
Skill0 starsChanged 58 days agoMITView on GitHub
Use iPhone Duo's hinge, two displays, two front cameras and multiple windows in SwiftUI and UIKit apps. Use when a developer asks about the hinge angle or fold state, onHingeChange or UIHingeInteraction, interactions driven by folding, Split View multitasking or the stacked video layout on iPhone Duo, multiple scenes or windows on iPhone, requestSceneSessionActivation errors on the outer display, UIWindowSceneActivationAction, scene accessories, sceneAccessory, CameraCaptureAccessory, a teleprompter or subject preview on the outer display, the virtual front camera, AVCaptureDeviceDirectionCoordinator and cameras that change direction when the device opens or closes, preview mirroring, or a widget so the app appears in StandBy on the outer display. Based on Apple's "Leverage multiple displays and scenes" and "Build a great camera experience for iPhone Duo". Not for column widths, safe areas or content around the fold (layout) or toolbar items (bars).
1 other project uses a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- alexey1312/iPhone-Duo-Agent-Skilledited, first seen Oct 9, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- alexey1312/iPhone-Duo-Agent-Skill★ 675% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository5 other files it gives its agents.
- AGENTS.mdAGENTS.md
- iphone-duo-adaptivity-auditSkill
- iphone-duo-barsSkill
- iphone-duo-layoutSkill
- iphone-duo-readinessSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 4 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 54
Verify: pose P8 in references/pose-test-matrix.md.
- Very specific: line 60
New windows cannot be created on the outer display: Every scene request must handle failure (scanner rule DUO010 flags errorHandler: nil).
- Very specific: line 62
Prefer UIWindowSceneActivationAction (Swift: UIWindowScene.ActivationAction) for "Open in New Window" controls: it hides itself when new …
- Very specific: line 131
Create an AVCaptureDeviceDirectionCoordinator(view:deviceTypes:) on the preview view, listing every built-in camera the app captures from — …
- Distinctive: line 156
Verify on a device — Simulator has no camera (pose P13).
- Very specific: line 179
Verify poses P7, P8, P9, P10 and P13 in references/pose-test-matrix.md.
- Distinctive: line 183
Never gate core functionality on the hinge or an accessory.
- Distinctive: line 184
Don't read hinge state once and cache it.
- Distinctive: line 185
Don't present a new-window affordance you have not checked is available.
- Very specific: line 186
Don't infer which way a camera faces from its type or position.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
iPhone Duo displays, hinge, scenes and cameras
Code: references/displays-code.md. Availability: references/api-availability.md —
the hinge APIs, CameraCaptureAccessory, the direction coordinator and the physical
front camera types need the iOS 27.1 SDK, which ships with Xcode 27.1;
sceneAccessory, onAvailabilityChange, UISceneAccessory and
UIWindowScene.ActivationAction exist earlier. The hinge reaches you only through
UIHingeInteraction / onHingeChange: there is no trait, no notification and no
UIDevice property. StandBy cannot be verified in the iPhone Duo simulator
(Xcode 27.1 known issues 187708663, 187708767). Which half
carries the outer display and the inner camera, how each pose faces, and what each
camera can do: references/device-geometry.md.
Hinge (Tech Talk 111464, 0:49–2:35)
- SwiftUI
onHingeChange { previous, context in … }; UIKitUIHingeInteraction { _, update in … }added to a view withaddInteraction. - Reports a status — closed, partially open, fully open (UIKit also
unknown) — and a continuous angle (UIHinge.angleis in radians; the SwiftUI sample usesAngle). context.hinge == nil(UIKit:update.hinge == nil) means the device has no hinge or the view left a hierarchy that provides hinge updates: every hinge feature must degrade to nothing on other devices.UIHingeInteraction.isEnabledpauses updates.- Filter for
.partiallyOpenwhen reading the angle, and reset in the else branch so the effect does not stick when the device opens flat or closes. - Hinge data drives interactions and effects, not layout. Layout uses arrangements
and reserved regions (
iphone-duo-layout). - Good fits: instruments, games, camera and media controls, playful physical interactions. Poor fits: anything essential — it must be reachable without folding.
Split View multitasking (2:59)
- All apps participate: two apps side by side on iPhone Duo, plus a new layout that stacks video and apps. There is no opt-out to lean on.
- Apps that already resize on iPad or in iPhone Mirroring start in good shape. Handle it with size classes and scene geometry, and the asymmetric safe areas it produces.
- Verify: pose P8 in
references/pose-test-matrix.md.
Multiple scenes (3:38)
- iPhone Duo is the first iPhone that shows multiple instances of an app's UI; apps that support multiple scenes on iPad get this too.
- New windows cannot be created on the outer display. Every scene request must
handle failure (scanner rule
DUO010flagserrorHandler: nil). - Prefer
UIWindowSceneActivationAction(Swift:UIWindowScene.ActivationAction) for "Open in New Window" controls: it hides itself when new windows are not available. - Apps that enable
UIApplicationSupportsMultipleScenesmust not rely on global window state (iphone-duo-adaptivity-audit, ruleDUO009). - An iPhone app that set the key to
falseto avoid coordinating state across windows now leaves Split View pairs and "open in new window" on the table. Treat it as a Tier 3 item: enable it only if the app tolerates several windows, test two windows on an iPad first, then on iPhone Duo. The scanner reports the key's value underproject.supports_multiple_scenes.
Scene accessories (4:22–6:25)
- Show content on more than one display at once, paired with the main UI — like a phone acting as a controller for a game on an external display.
- The system controls availability and it can change at any time; accessories are enabled by default and can be toggled. Observe availability and update any control that turns the accessory on.
- Camera capture accessory (camera apps): extra UI on the outer display while the main UI stays on the inner display — show the subject a preview, a countdown, a teleprompter. Available only when the app is full screen on the inner display with an active camera session. Register it on the same view as the camera UI, so it appears only while that view is visible.
- Pattern:
.sceneAccessory { CameraCaptureAccessory(isEnabled: $model.isEnabled) { … } .onAvailabilityChange { model.isAvailable = $0 } }and a toolbar toggle disabled when unavailable (for example when the device is closed). - UIKit:
UISceneAccessory.cameraCapture(sceneConfiguration:userInfo:)passed toregisterSceneAccessory(_:)on the capture view controller; keep the returnedUISceneAccessoryRegistration(isAvailableis observable — read it inupdateProperties(); setisEnabledfrom the toggle) and callunregisterSceneAccessory(_:)when the app stops offering the content. The accessory scene's session role iswindowCameraCaptureAccessory; the shared model arrives asconnectionOptions.sceneAccessoryUserInfo. No scene-manifest entry is needed or honored. (Apple documentation › Registering a camera capture accessory) - The system presents the top-most registration of a kind, withdraws content when capture stops, the app leaves the foreground or the device closes, and lets different accessory kinds coexist (a connected external display and the outer display at once). Share one model between the capture UI and the accessory instead of passing messages; the outer display accepts touch, so a single control (pause the script, tap to focus) is fine, a second interface is not.
- Simulator has no camera: previews and Simulator check the accessory's layout, only a device shows it.
Before proposing a camera accessory
An accessory is only available with an active camera session, so check the session
really runs: a camera usage description (NSCameraUsageDescription), an authorization
request, inputs added without swallowed errors, and outputs for what the app records.
Missing prerequisites come first in the plan — otherwise the accessory silently never
appears and looks like an iPhone Duo bug. Recording itself must never wait on the
accessory being available.
Cameras (Tech Talk 111465; Apple documentation › Choosing a camera by the direction it faces)
iPhone Duo has two front cameras, both square ultrawide sensors: the outer camera and the under-display inner camera. Which way a camera faces depends on the display the app is on, and opening or closing the device moves the app to the other display.
- Existing front-camera code keeps working. A
DiscoverySessionwith position.frontand the wide or ultra wide type returns the Virtual Front Camera, oneAVCaptureDevicethat streams from the inner camera when open and the outer camera when closed (isVirtualDevice == true;activePrimaryConstituentnames the streaming camera). It offers only what both cameras share — 1080p, 60 fps, no depth. (1:01, 2:28) - Capture-first apps use the physical cameras.
builtInOuterUltraWideCamera(up to 4K at 120 fps) andbuiltInInnerUltraWideCamera(1080p up to 60 fps) expose each camera fully, and switching on open/close becomes the app's job. (1:53) positionis where a camera sits, not where it points. Both front cameras report.front; a front camera can face away from the person looking at the app, and the rear cameras face the person when the open device is turned around. Create anAVCaptureDeviceDirectionCoordinator(view:deviceTypes:)on the preview view, listing every built-in camera the app captures from — rear types included, the two physical front types instead of the virtual one — and keep it alive while the view is on screen. Its handler reports anAVCaptureDeviceDirectionMap; pick fromforwardFacingDeviceDescriptorswhen the active camera is no longer in it. (2:53–4:49)- The handler runs on the main actor and never touches AVFoundation. It hands an
AVCaptureDeviceDescriptor(Sendable) to the actor that owns the session, which resolves it withAVCaptureDevice(uniqueID:), handles anilresult, and swaps the single video input insidebeginConfiguration/commitConfiguration. Two displays showing a preview (a capture accessory) mean two coordinators, one per view. (5:37–6:16) - Mirror by direction, not position. A forward-facing rear camera is a selfie
camera and needs a mirrored preview; a backward-facing front camera does not. Set
automaticallyAdjustsVideoMirroring = falsebefore assigningisVideoMirrored(assigning while it adjusts raises), only when position and direction disagree, and reapply after reconnecting an input. Mask the preview while the new camera starts. - Rotation. Adopt
AVCaptureDevice.RotationCoordinator; it updates when the app moves displays, and it is created per device, so make a new one on every camera switch. Then disable camera-sensor-orientation compensation, which is on for every front camera on iPhone Duo, to save work. (8:08) - Preview polish. A full-field-of-view rear preview on the inner display leaves
room around it: offset the preview and put controls in the remaining space, or
fill with
videoGravity.dynamicAspectRatiolets the square front sensors deliver a landscape frame on the inner display. (7:03) - Verify on a device — Simulator has no camera (pose P13).
StandBy on the outer display (Apple newsroom; HIG › Live Activities)
StandBy runs on either display "even when it's not charging": a folded or tented
iPhone Duo on a desk is a screen facing the room, filled with widgets and Live
Activities. An app with neither is absent from it. For apps that have a natural
glanceable state (next event, timer, score, order status), a widget or Live Activity
is a Tier 3 item; the scan inventory reports WidgetKit and Live Activities
adoption. The Dynamic Island on the side stack expands vertically for Live Activities
(HIG › Reserved regions), so nothing extra is needed there.
Workflow
- From the scan inventory:
AVCaptureSession→ camera accessory candidate, and withfront camera discoveryorvideo mirroring→ camera direction review;multiple scene requestsorUIApplicationSupportsMultipleScenes→ scene handling review; custom gesture or sensor-driven features → hinge candidates; noWidgetKit/Live Activities→ StandBy presence item. - Correctness first: scene request errors, Split View sizes, cameras that face the wrong way after opening or closing. Then opportunities: accessory, hinge, widget.
- Recommend with
references/recommendation-format.md; mark 27.1 APIs blocked when the SDK lacks them; apply after approval; build. - Verify poses P7, P8, P9, P10 and P13 in
references/pose-test-matrix.md.
Guardrails
- Never gate core functionality on the hinge or an accessory.
- Don't read hinge state once and cache it; it is live.
- Don't present a new-window affordance you have not checked is available.
- Don't infer which way a camera faces from its type or
position; ask a direction coordinator, and write one code path that also runs on single-display iPhones (there the coordinator reports once and never changes).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

