MCPInstall

iphone-duo-camera

Build camera capture for iPhone Duo's two front cameras — the virtual front camera, the inner under-display and outer ultra-wide devices, AVCaptureDeviceDirectionCoordinator, preview mirroring and video gravity, and dual-display capture. Use when an app captures photo or video and must handle the device opening, closing or flipping.

Installs
525
Last 24h
+24
Trending rank
#5060
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/mirzaaghazadeh/iphone-duo-skills --skill iphone-duo-camera
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads iphone-duo-camera automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

Camera on iPhone Duo

iPhone Duo is the first iPhone with two front cameras. Both are square sensors with an ultra-wide field of view: one on the outer display, and one beneath the inner display — the first under-display camera on iPhone.

That creates a problem no previous iPhone had. "Front" no longer means "pointing at the user."

Pick a strategy first

Everything downstream follows from this choice.

The virtual front camera — automatic, limited

Discover a front camera the ordinary way — an AVCaptureDevice.DiscoverySession requesting position .front with a Wide or Ultra Wide device type — and on iPhone Duo you resolve to a new virtual front camera. It switches between the two physical cameras by itself: inner camera when open, outer camera when closed.

It always uses the most relevant camera, and you write no switching code.

The cost is that it exposes only what both physical cameras can do:

  • max 1080p, 60 fps
  • no depth

If the app needs 4K, high frame rates, or any depth-based feature, this is not enough.

The individual cameras — full capability, your responsibility

Address each physically, via the built-in outer ultra-wide and built-in inner ultra-wide device types:

Inner (under-display)Outer
Max video1080p @ 60 fps4K @ 120 fps
Depthsupportedsupported

Full capabilities, but now you must switch cameras when the user opens or closes the device. Which brings us to the hard part.

Which way is a camera actually facing?

AVCaptureDevice has always had a fixed position — on iPhone, .back or .front. Both of iPhone Duo's front cameras report .front. That property describes where a camera sits on the hardware, and on a device whose displays can face opposite directions it no longer tells you where the camera points relative to the person looking at your UI.

Three situations make this concrete:

  • The user is looking at the inner display while the app streams the outer front camera — a "front" camera facing away from them.
  • The device closes while that camera is streaming, and the same camera swings around to face them directly.
  • The device is open and flipped, so a rear camera is now the selfie camera.

AVCaptureDeviceDirectionCoordinator

AVCaptureDeviceDirectionCoordinator (in AVKit) answers the real question: which cameras are forward-facing right now, relative to a given view. Build one from three things — your app's UIView, the device types to monitor, and a change handler — and it keeps you current as the device moves.

Because it is anchored to a view, it reports facing relative to the display that view is on. When the view is on the outer display, the outer front cameras are forward-facing and the rear cameras are backward-facing. Open the device, the view moves to the inner display, your handler fires, and now the inner front camera is forward-facing while the outer front and rear cameras are backward-facing.

Driving both displays at once? Create one coordinator per view. Each reports relative to its own display, so the same rear camera is forward-facing to the outer view's coordinator and backward-facing to the inner view's. That is correct, not contradictory — it is the whole point. (Dual-display camera UI comes from the scene accessories API; see ../iphone-duo-hinge-and-scenes/SKILL.md.)

Concurrency

The coordinator is tied to a view, so it is isolated to the main actor. Your change handler must not call AVFoundation APIs directly.

It never hands you an AVCaptureDevice. The handler receives an AVCaptureDeviceDirectionMap, which sorts the tracked cameras into two arrays:

var forwardFacingDeviceDescriptors: [AVCaptureDeviceDescriptor]
var backwardFacingDeviceDescriptors: [AVCaptureDeviceDescriptor]

The same map is also readable at any time from the coordinator's deviceDirections property, so you aren't limited to reacting inside the handler.

An AVCaptureDeviceDescriptor is a sendable stand-in for a capture device, carrying uniqueID, localizedName, deviceType, mediaTypes and position. Pass a descriptor to your camera actor and construct the AVCaptureDevice there. That is the intended path; don't try to smuggle a device across the boundary.

Note that both of these types live in AVKit, alongside the coordinator — not in AVFoundation, where you might reasonably go looking first.

Because you get arrays rather than a single device, your handler has to choose: typically the first forward-facing descriptor whose deviceType matches what you're streaming. Don't assume exactly one camera faces forward.

What the handler should do

  1. Reconfigure the AVCaptureSession to keep streaming from whichever camera is now forward-facing.
  2. Re-evaluate mirroring. Mirroring should follow the direction, not the position: when a rear camera has become the forward-facing one, mirror the preview so it feels like a normal selfie view.
  3. Apply any UI updates the camera change implies.

Preview polish

Streaming the rear camera's full field of view on the inner display leaves extra room around the preview. Two reasonable choices: offset the preview and group controls in the space left over, or let the preview fill the display. Control this with videoGravity on AVCaptureVideoPreviewLayer.

Streaming an ultra-wide front camera, exploit the square sensor — set dynamicAspectRatio on the AVCaptureDevice to pick a landscape aspect ratio that fills the inner display.

Rotation. Adopt AVCaptureDeviceRotationCoordinator so previews and captures stay upright. On iPhone Duo it updates when the app moves between displays, which is what keeps rotation consistent across both. Once you have adopted it, turn off camera-sensor-orientation compensation — it is enabled on all of iPhone Duo's front cameras and is redundant work once the rotation coordinator is doing the job.

Note that direction and rotation are separate coordinators solving separate problems. Which camera to stream is direction; which way its output is oriented is rotation. Most camera apps on this device want both.

Checklist

  1. Build against the iOS 27.1 SDK.
  2. Decide: virtual front camera (automatic, 1080p60, no depth) or individual cameras (full capability, manual switching).
  3. If individual, adopt AVCaptureDeviceDirectionCoordinator — one per view.
  4. In the change handler, read the AVCaptureDeviceDirectionMap, pick a forward-facing descriptor, reconfigure the session, re-decide mirroring, and update UI. Move devices across actors as AVCaptureDeviceDescriptor.
  5. Set videoGravity, and dynamicAspectRatio for front-camera capture.
  6. Adopt AVCaptureDeviceRotationCoordinator, then disable sensor-orientation compensation.
  7. Consider a CameraCaptureAccessory so the subject sees something on the outer display.
  8. Test opening, closing and flipping the device mid-session in Device Hub.

Apple's related articles: Choosing a Camera by the Direction it Faces and Supporting Device Rotation in Your Camera App. For the square sensor generally, see Support the Center Stage front camera in your iOS app from WWDC26.

FAQ

What does the iphone-duo-camera skill do?

Build camera capture for iPhone Duo's two front cameras — the virtual front camera, the inner under-display and outer ultra-wide devices, AVCaptureDeviceDirectionCoordinator, preview mirroring and video gravity, and dual-display capture. Use when an app captures photo or video and must handle the device opening, closing or flipping.

How do I install iphone-duo-camera?

Run npx skills add https://github.com/mirzaaghazadeh/iphone-duo-skills --skill iphone-duo-camera in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/iphone-duo-camera/ (personal) or .claude/skills/iphone-duo-camera/ (project).

Which AI agents can use iphone-duo-camera?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is iphone-duo-camera safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains iphone-duo-camera?

It is published by mirzaaghazadeh in mirzaaghazadeh/iphone-duo-skills. It has 525 recorded installs.

More from mirzaaghazadeh/iphone-duo-skills

View all →

iphone-duo-readiness

mirzaaghazadeh/iphone-duo-skills

Audit and port an iOS app to iPhone Duo, Apple's first foldable iPhone. Use when asked to support, adapt, prepare, test, or review an app for iPhone Duo, foldable iPhone, the inner/outer display, device poses, or the fold. Entry point that routes to the layout, bars, hinge/scenes, camera, and design skills.

Mobile690 installs

iphone-duo-adaptive-layout

mirzaaghazadeh/iphone-duo-skills

Build layouts that adapt to the iPhone Duo fold using reserved regions, division and occlusion regions, displacement patterns, and the split and overlay ArrangementView containers. Use when content or controls land in the fold, when building a split-like or overlay layout, or when custom manually-positioned UI must avoid the hinge or the under-display camera.

Frontend & Design664 installs

iphone-duo-design-review

mirzaaghazadeh/iphone-duo-skills

Review or design an iOS interface for iPhone Duo's poses — closed, open, book-folded, tabletop and tent — covering side-mounted controls, asymmetric layouts, fold avoidance, sheets, and how to use the inner display well. Use for design critique, mockup review, or deciding what a screen should look like on a foldable iPhone rather than how to code it.

Mobile636 installs

iphone-duo-vertical-bars

mirzaaghazadeh/iphone-duo-skills

Adapt toolbars, navigation bars and tab bars for the vertical axis on iPhone Duo — item ordering, symbol vs text representations, axis behavior, overflow menus, visibility priority, and when to opt out. Use when toolbar items look wrong, overflow too early, or need to move to the side on the outer display.

Mobile626 installs

iphone-duo-hinge-and-scenes

mirzaaghazadeh/iphone-duo-skills

Use the iPhone Duo hinge angle for interactions and effects, support Split View multitasking and multiple app scenes, and pair UI across both displays with scene accessories including CameraCaptureAccessory. Use when building fold-driven effects, multi-window support, or dual-display experiences.

Mobile598 installs

iphone-duo-react-native

mirzaaghazadeh/iphone-duo-skills

Open the skill to read its SKILL.md instructions.

Mobile476 installs

Popular mobile skills

View category →

design-mobile-apps

designed-by-ai/skills

Design mobile app screens with Sleek, edit Sleek projects, and implement their designs in React Native or HTML.

Mobile1.1M installs

ios-design

uizze.sh

Design and review iOS UI/UX for iPhone apps in SwiftUI, UIKit, or React Native. Use for mobile app design, screen redesigns, navigation flows, typography, forms, keyboard and safe-area layout, and accessibility checks. Apply Apple Human Interface Guidelines and consult real product references through the optional Uizze connection.

Mobile416.5K installs

vercel-react-native-skills

vercel-labs/agent-skills

React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.

OfficialMobile256.7K installs

animate-expo

emilkowalski/skills

Build animations in React Native and Expo, making the decisions in the order that determines whether they feel right — should it animate, which thread it runs on, which properties, spring or timing, how the gesture hands off, how it degrades. Writes the implementation with Reanimated, Gesture Handler, Expo Router and expo-haptics. Use when animating anything in an Expo app, adding gestures, sheets, screen transitions, press feedback or haptics, or fixing motion that stutters on device. For web animation use animate.

Mobile140.1K installs

xcode-project-setup

firebase/agent-skills

Safely modifies Xcode projects (.pbxproj) to add Swift Packages and link files. Use this skill whenever an iOS project needs dependencies installed (e.g. Firebase, Alamofire).

OfficialMobile131.2K installs

firebase-remote-config-basics

firebase/agent-skills

Manages Firebase Remote Config templates, feature flags, loading strategies, and SDKs (Android, iOS). Use when downloading/deploying remoteconfig JSON templates, managing version history/feature flags, setting in-app defaults, fetchAndActivate(), real-time listeners, or SDK setup. Don't use for Firebase Hosting, Auth, Firestore, Data Connect, Crashlytics, or App Hosting.

OfficialMobile121.7K installs