Platform features

Camera apps and the outer display

iPhone Duo camera development: the Virtual Front Camera, inner and outer ultrawide cameras, AVCaptureDeviceDirectionCoordinator, and CameraCaptureAccessory for showing live UI on the outer display.

8 min readUpdated 4 sources

iPhone Duo features two front-facing cameras, both built around square-sensor ultrawides:

Camera Location Max capture
Outer ultrawide Above the 5.4-inch outer display 4K at 120 fps
Inner ultrawide Under the 7.6-inch inner display (the first under-display camera on iPhone) 1080p at 60 fps

It is also the first iPhone where a camera’s physical .position doesn’t guarantee which way it points relative to the viewer. When the phone is open and flipped around, the rear Fusion cameras face whoever is looking at the outer display.1

The easy path: Virtual Front Camera

If you query AVCaptureDeviceDiscoverySession for a .front camera of type .builtInWideAngleCamera or .builtInUltraWideCamera just as you do today, iOS returns the Virtual Front Camera. It automatically switches between the outer and inner front sensors as the user folds and unfolds the phone.1

Because the virtual device exposes only the capabilities shared by both sensors — up to 1080p at 60 fps, without depth capture — most video-calling, selfie, and barcode-scanning apps get seamless fold transitions without changing a line of camera code.1

Full control: addressing physical cameras directly

If your app needs 4K recording, 120 fps capture, or depth data from the outer sensor, discover the physical cameras explicitly using .builtInOuterUltraWideCamera and .builtInInnerUltraWideCamera. When you use the physical devices directly, your app is responsible for switching inputs when the phone opens or closes.1

Tracking which way each camera faces

Because AVCaptureDevice.position reports both front sensors as .front, it can’t tell you which sensor currently faces the user. Use AVCaptureDeviceDirectionCoordinator instead — it resolves camera directions relative to a specific view and invokes your handler whenever the device folds or flips:

directionCoordinator = AVCaptureDeviceDirectionCoordinator(
    view: view,
    deviceTypes: [
        .builtInOuterUltraWideCamera,
        .builtInInnerUltraWideCamera,
        .builtInDualWideCamera,
    ],
    changeHandler: { [weak self] map in
        self?.updateCameraSession(map)
    }
)

Inside your change handler:

  1. Reconfigure your AVCaptureSession to stream from the sensor now facing your target subject.
  2. Update preview mirroring — when a rear camera faces the user for a selfie preview, enable mirroring so movement feels natural.
  3. Update your camera controls to match the active sensor’s capabilities.

Because the coordinator is bound to a UIView, its callback runs on @MainActor. Don’t block the main thread with AVCaptureSession configuration: pass the Sendable AVCaptureDeviceDescriptor from the map to your dedicated camera actor and instantiate the AVCaptureDevice there.1

Polishing the camera preview

  • Use spare canvas space wisely. Streaming the sensor’s full field of view leaves letterboxed margins on the inner display. Use videoGravity on AVCaptureVideoPreviewLayer either to shift the preview clear of your shutter controls or to fill the screen.
  • Adapt aspect ratio dynamically. The square front sensors let you switch between portrait and landscape crops without rotating the phone via dynamicAspectRatio on AVCaptureDevice.4
  • Keep previews upright. Adopt AVCaptureDeviceRotationCoordinator so previews and captured media stay oriented properly, including when your app transitions between the outer and inner displays.1
  • Avoid double orientation work. Hardware sensor orientation compensation is enabled by default on both iPhone Duo front cameras. Disable isCameraSensorOrientationCompensationEnabled on AVCapturePhotoOutput if your pipeline already rotates buffers manually.
  • Stay clear of the inner camera cutout. While the inner under-display camera is active, keep custom overlays out of its .occlusion reserved region.

Showing custom UI on the outer display

Camera apps are the only third-party apps allowed to project custom UI onto the outer display while the user is working on the inner display — for example, displaying a teleprompter to someone on camera, a framing preview, or an animation that gets a child to look at the lens. You register this secondary view using a camera capture accessory attached to your main camera view.12

The system displays your accessory on the outer screen only while your app is foregrounded, full-screen on the inner display, and running an active AVCaptureSession. iOS can withdraw the accessory at any time (for example, when the user folds the phone shut).2

struct CameraRootView: View {
    @State private var model = TeleprompterModel()

    var body: some View {
        CameraView(model: model)
            .sceneAccessory {
                CameraCaptureAccessory(isEnabled: $model.isEnabled) {
                    TeleprompterView(model: model)
                }
                .onAvailabilityChange { model.isAvailable = $0 }
            }
            .toolbar {
                TeleprompterToggle(isEnabled: $model.isEnabled)
                    .disabled(!model.isAvailable)
            }
    }
}

In UIKit, register a UISceneAccessory via registerSceneAccessory(_:) and toggle it with UISceneAccessoryRegistration.isEnabled (accessories are enabled by default).2

If you render live camera previews on both displays simultaneously, create a separate preview UIView and a separate AVCaptureDeviceDirectionCoordinator for each display. Each coordinator reports camera directions relative to its own view — so the outer display’s coordinator naturally sees the rear cameras as facing forward.1

Building a non-camera app?

Non-camera apps cannot render custom views on the outer display while the phone is open. To surface live status on the outer screen, adopt system surfaces like Live Activities (such as an AlarmKit timer) and the Dynamic Island.3

Sources

  1. Tech Talk: Build a great camera experience for iPhone Duo
  2. Tech Talk: Leverage multiple displays and scenes on iPhone Duo
  3. Apple Developer Forums: A summary of the iPhone Duo Group Lab
  4. WWDC26: Support the Center Stage front camera in your iOS app