
iphone-duo-capacitor
Adapt a Capacitor or Ionic app to iPhone Duo, Apple's first foldable iPhone — why the standard Device Posture and Viewport Segments CSS does not reach a web view, what CSS gives you today, and how to get fold state, hinge angle and bar placement from the native side. Use when a Capacitor, Ionic, Angular, React or Vue app needs foldable iPhone support.
- Installs
- 324
- Last 24h
- +24
- Trending rank
- #5027
- 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-capacitor- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads iphone-duo-capacitor automatically when relevant.
- 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.
Capacitor on iPhone Duo
Start here, because it is the thing that will waste your afternoon otherwise:
WebKit 27.1 implements Device Posture and Viewport Segments, but both sit behind an experimental flag that only Safari can set.
A Capacitor app runs in a WKWebView it does not control the flags of, so
navigator.devicePosture, the device-posture media query and the
env(viewport-segment-*) variables are all absent there, while the same page in
Safari on the same device can see them. Feature-detect rather than assume, and
plan for both to be missing.
So the web platform gives you no fold awareness on this device out of the box. What it does give you is most of what matters. Work in two tiers.
Tier 1 — works today, no native code
Trust safe areas, and never assume symmetry
This is the one that produces real bugs. iOS moves its bars to one side of the display, and that side depends on the pose and the reading direction.
The bar arrives as a genuine safe-area inset: measured on the 27.1 simulator it
is env(safe-area-inset-right) of 84px, and it moves to
env(safe-area-inset-top) of 82px if the app opts out of vertical bars,
live and without a reload. So most layouts need nothing more than honest
env(safe-area-inset-*) padding on all four edges.
Any expression of the form width - env(safe-area-inset-left) * 2 is a defect
on this device.
Resize correctly
The window changes size constantly: opening, closing, folding, rotating, Split
View. Read sizes when you need them rather than caching, and prefer container
queries and %/fr layout over stored pixel values. Anything measured in a
useEffect or ngOnInit and kept will be stale within seconds.
Think in size classes, not device checks
iOS reasons about this device in size classes: the outer display is compact width, the inner display is regular width. Branch on the size you were given, never on a user-agent string or an orientation, since the inner display does not honour supported orientations.
Measured on the simulator: inner display 951×669 in landscape, outer display 466×678.
Move navigation to the side on the wide display
When iOS moves its own tab bars and toolbars to a vertical rail, an HTML tab bar pinned to the bottom looks unconverted next to every native app. A side rail on the inner display and a bottom bar on the outer one is the web analogue, and it costs one breakpoint.
Tier 2 — needs the native side
Everything genuinely iPhone Duo-specific is invisible to the web view until something native hands it over.
| Native API (iOS 27.1) | Why you want it in the web view |
|---|---|
reservedRegions(kind:options:) on UIView | Where the fold and the camera are, so layout can avoid them |
UIHingeInteraction | Continuous hinge angle, for effects and posture |
verticalBarEdge on the trait collection | Which edge iOS moved the bars to, so your own chrome matches |
Size class from traitCollection | The signal iOS actually uses, rather than your breakpoint guess |
Two details worth knowing before you write any of this yourself. A flat phone's
fold region is reported inactive, so reading it needs
options: .includeInactive or you will conclude the device has no hinge. And
UIHinge.status updates lazily, so it disagrees with the angle mid-fold; treat
the angle as the truth when both are available.
Use the existing bridge
@erkamyaman/capacitor-foldable
is an MIT plugin that already does this, and also fills in Device Posture and
Viewport Segments so the standard CSS works in an app today:
npm install @erkamyaman/capacitor-foldable
npx cap sync
import { Foldable, installFoldablePolyfill } from '@erkamyaman/capacitor-foldable';
await installFoldablePolyfill();
const fold = await Foldable.getFoldState();
await Foldable.addListener('foldStateChange', (state) => layout(state));
The polyfill sets --fold-left, --fold-width and friends on <html>, so a
grid can put its gutter exactly on the crease rather than guessing. The same
build covers Android foldables through androidx.window.
Deeper material lives in iphone-duo-capacitor-skills: the CSS patterns, the full API, Ionic specifics, and how to test on the simulator and on an Android emulator.
Ionic apps
Ionic's ion-tabs is HTML, so it stays at the bottom while native bars move.
Two routes: a stylesheet that turns the tab bar into a side pill on the edge iOS
chose, or @rdlabo/capacitor-native-ui,
which renders existing ion-buttons, ion-button, ion-back-button and
ion-tab-bar with UIKit and SwiftUI while the originals, their state and their
handlers stay in the web view. It takes device state as input, so the two
compose rather than compete, and it lists the plugin in its own setup. The optional
@rdlabo/ionic-theme-ios27
adds iOS 27 styling on top.
What to do, in order
- Audit every safe-area expression for assumed symmetry. Most bugs die here.
- Stop caching sizes, and branch on the size you were handed.
- Give the wide display a real layout rather than a stretched phone one.
- Add the plugin, and feature-detect the standard APIs so the same build still works in a browser that has them.
- Only then reach for hinge angle effects, which are the smallest part of a good port.
Steps 1 to 3 need no native code and improve the app on tablets at the same time. Step 4 is the only iPhone Duo-specific part, and it cannot be tested without the Xcode 27.1 simulator.
For what the native APIs do and why, read ../iphone-duo-adaptive-layout/SKILL.md
and ../iphone-duo-vertical-bars/SKILL.md — the design reasoning transfers
directly even though the code does not.
FAQ
What does the iphone-duo-capacitor skill do?
Adapt a Capacitor or Ionic app to iPhone Duo, Apple's first foldable iPhone — why the standard Device Posture and Viewport Segments CSS does not reach a web view, what CSS gives you today, and how to get fold state, hinge angle and bar placement from the native side. Use when a Capacitor, Ionic, Angular, React or Vue app needs foldable iPhone support.
How do I install iphone-duo-capacitor?
Run npx skills add https://github.com/mirzaaghazadeh/iphone-duo-skills --skill iphone-duo-capacitor 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-capacitor/ (personal) or .claude/skills/iphone-duo-capacitor/ (project).
Which AI agents can use iphone-duo-capacitor?
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-capacitor 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-capacitor?
It is published by mirzaaghazadeh in mirzaaghazadeh/iphone-duo-skills. It has 324 recorded installs.
More from mirzaaghazadeh/iphone-duo-skills
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.
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.
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.
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.
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.
iphone-duo-camera
mirzaaghazadeh/iphone-duo-skills
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.
Popular mobile skills
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.
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.
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.
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.
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).
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.