iPhone Duo’s two front cameras — an outer ultrawide and the first under-display inner ultrawide on iPhone — exposed individually via AVFoundation, plus a Virtual Front Camera that switches between them automatically as the device opens and closes.
• Virtual Front Camera handles switching between outer and inner cameras automatically — most apps should adopt it instead of managing two devices manually
• Apps needing manual control (video calling, custom capture UI) can access builtInOuterUltraWideCamera and builtInInnerUltraWideCamera individually and track switches with a direction coordinator
• Preview aspect ratio, positioning, and rotation all need explicit handling since the two cameras sit in physically different places on the device
Configures the Virtual Front Camera for automatic inner/outer switching, and observes direction changes to keep a preview layer’s aspect ratio and rotation correct as iPhone Duo opens and closes.
import AVFoundation
final class DuoFrontCameraController: NSObject {
private let session = AVCaptureSession()
private var directionObservation: NSKeyValueObservation?
let previewLayer = AVCaptureVideoPreviewLayer()
func start() throws {
// Virtual Front Camera: the system picks outer or inner
// automatically based on the device's current pose.
guard let device = AVCaptureDevice.default(.builtInDualWideCamera, for: .video, position: .front) else {
throw CameraError.unavailable
}
let input = try AVCaptureDeviceInput(device: device)
session.beginConfiguration()
if session.canAddInput(input) { session.addInput(input) }
session.commitConfiguration()
previewLayer.session = session
previewLayer.videoGravity = .resizeAspectFill
let rotationCoordinator = AVCaptureDevice.RotationCoordinator(device: device, previewLayer: previewLayer)
previewLayer.connection?.videoRotationAngle = rotationCoordinator.videoRotationAngleForHorizonLevelPreview
session.startRunning()
}
}
enum CameraError: Error { case unavailable }The foundational adaptation layer for iPhone Duo: build against the iOS 27 / 27.1 SDK, simulate poses with DeviceHub in Xcode, and use size classes (not interface orientation) to lay out across the outer and inner displays.
Apple’s design system for iPhone Duo’s reimagined iOS: controls move to the outer edge, content displaces away from the hinge, and interfaces adapt across held, used, and folded poses.
APIs for observing continuous hinge angle and open/closed state (onHingeChange / UIHingeInteraction), plus scene accessories that present supplementary content on iPhone Duo’s second display simultaneously with the main UI.
In-depth guide
iPhone Duo & Foldables in iOS 27 →• The inner ultrawide is the first under-display camera on iPhone — test preview quality separately from the outer camera
• Use AVCaptureDeviceRotationCoordinator to keep preview and captured photos upright as the device folds
• isCameraSensorOrientationCompensationEnabled trades a small performance cost for correct sensor orientation — don’t enable it blindly
iPhone Duo hardware only — no simulator equivalent for camera capture
New toolbar, tab bar, and navigation bar axis behavior for iPhone Duo’s wider aspect ratio, where top/bottom controls move to a shared vertical region along the side of the display.