iPhone Duo Developer Hub · Blog

Leverage Multiple Displays & Scenes on iPhone Duo

Apple Developer session · 7m 18s · Watch on YouTube ↗

Leverage Multiple Displays & Scenes on iPhone Duo

Source: Leverage multiple displays and scenes on iPhone Duo (Apple Developer) · 7 min 18s

By Chris Donegan (UI Frameworks) and Alex Muller (System Experience).

Three things make iPhone Duo apps feel magical: responding to the hinge, supporting split-view multitasking, and using scene accessories to show UI across two displays at once. Here's the engineering.

1. Respond to the hinge

Your app can read the hinge state and drive interactions with it (think: wallpaper zooming as you open the device).

Both give the high-level status (closed / partially open / fully open) plus continuous updates of the hinge angle.

```swift

// SwiftUI — about as simple as it gets

GuitarView()

.onHingeChange { _, current in

guard let hinge = current.hinge,

hinge.status == .partiallyOpen

else { pitchBend = 0; return } // null hinge = no hinge; reset otherwise

pitchBend = amount(from: hinge.angle) // drive your effect

}

```

Notes: a null hinge means the app runs on a device without one (always guard for it). Hinge data is ideal for interactions and effects; for layout, use the Arrangement and Reserved Regions APIs instead (see Strike a Pose).

2. Split-view multitasking

All apps participate in side-by-side multitasking on iPhone Duo. If your app already resizes on iPad or iPhone mirroring, you're most of the way there. Duo also has a video-stacking layout — your app handles both the same way via size classes and scene geometry.

Multiple instances: Duo is the first iPhone to support multiple instances of your app's UI. If you support it on iPad, you get it here — with one caveat:

So availability is dynamic — make sure to handle errors when requesting new scenes, and use UIWindowSceneActivation, which auto-hides when windows aren't available.

3. Scene accessories: span two displays at once

Scene accessories pair extra content with your app's main UI (like using your iPhone as a game controller on a big screen). The system controls availability — they're enabled by default but can toggle anytime — so observe availability changes with onAvailabilityChange to stay in sync.

New for Duo camera apps — CameraCaptureAccessory: lets you put secondary UI on the outer display while the main UI stays on the inner display — e.g. a teleprompter, or showing your subject a preview while you photograph them.

```swift

CameraView()

.sceneAccessory(CameraCaptureAccessory {

Teleprompter(model: teleprompter)

.onAvailabilityChange { teleprompter.available = $0 }

})

```

Available when your app is full screen on the inner display and has an active camera session. Register it on the same view as your camera UI; it only shows while that view is visible.


To make your app magical

  1. Update for split-view multitasking.
  2. Use the hinge API for interactions and effects.
  3. Adopt scene accessories to span both displays.

Camera specifics (front cameras, direction) are in "Build a great camera experience on iPhone Duo."

Videos · Specs · Prices · Apps

Unofficial dev hub. Not affiliated with, endorsed by, or sponsored by Apple Inc.