К основному содержанию
скилл CX Codex

iphone-duo-capacitor — скилл для Claude Code: Capacitor на iPhone Duo

Скилл iphone-duo-capacitor готовит приложение на Capacitor или Ionic к iPhone Duo: safe area, size classes и мост к нативным API складки, когда стандартный CSS не срабатывает.

MIT 577 установок ★ 333 обновлён 2026-10-23

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add mirzaaghazadeh/iphone-duo-skills --skill iphone-duo-capacitor -a claude-code
Открыть на GitHub

Что делает iphone-duo-capacitor

Скилл разбирает перенос приложения на Capacitor или Ionic под iPhone Duo. Засада в том, что WebKit 27.1 умеет Device Posture и Viewport Segments, но обе возможности спрятаны за экспериментальным флагом, который ставит только Safari. В WKWebView флаги не переключить, поэтому navigator.devicePosture, медиазапрос device-posture и переменные env(viewport-segment-*) там отсутствуют.

Первый уровень обходится без нативного кода. iOS сдвигает панели на одну сторону, и сторону выбирает по позе и направлению чтения: на симуляторе 27.1 это env(safe-area-inset-right) в 84px, а при отказе от вертикальных панелей — env(safe-area-inset-top) в 82px. Выражение width - env(safe-area-inset-left) * 2 на этом устройстве ломается. Размеры окна меняются постоянно: кэш пикселей из useEffect устареет за секунды. Ветвление — по size class, снаружи compact width, внутри regular width.

Второй уровень требует нативной стороны: reservedRegions, UIHingeInteraction, verticalBarEdge. Плагин @erkamyaman/capacitor-foldable под MIT ставится через npm install и npx cap sync, поднимает полифилл и слушает foldStateChange. У плоского телефона область сгиба inactive — без options: .includeInactive решите, что шарнира нет. Шаг с плагином проверяется только на симуляторе Xcode 27.1.

Какие задачи решает

  • убрать допущение о симметричных safe area из отступов
  • перевести ветвление с user-agent на size class
  • сделать боковую навигацию на внутреннем экране
  • получить состояние сгиба и угол шарнира в веб-вью
  • перевести ion-tabs на нативную панель через @rdlabo/capacitor-native-ui

Примеры запросов агенту

  • Проверь все выражения с env(safe-area-inset-*) в проекте на допущение о симметрии.
  • Подключи @erkamyaman/capacitor-foldable и передай состояние сгиба в лейаут.
  • Переделай ion-tabs в боковую панель на внутреннем экране iPhone Duo.

Как установить iphone-duo-capacitor

1Через Skills CLI (Vercel)

npx skills add mirzaaghazadeh/iphone-duo-skills --skill iphone-duo-capacitor -a claude-code

2Вручную: положить файлы

~/.claude/skills/iphone-duo-capacitor/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/iphone-duo-capacitor/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы об iphone-duo-capacitor

Как установить iphone-duo-capacitor в Claude Code?

Выполните npx skills add mirzaaghazadeh/iphone-duo-skills --skill iphone-duo-capacitor -a claude-code. Файл скилла окажется по пути ~/.claude/skills/iphone-duo-capacitor/SKILL.md.

Что делает iphone-duo-capacitor?

Описывает, как довести приложение на Capacitor или Ionic до iPhone Duo: честные safe area на всех четырёх краях, вёрстка по size class и мост к нативным API складки там, где CSS бессилен.

Почему Device Posture не работает в Capacitor?

В WebKit 27.1 эти возможности стоят за экспериментальным флагом, который выставляет только Safari. В WKWebView флаг недоступен, поэтому navigator.devicePosture и env(viewport-segment-*) приходится определять в рантайме и обходиться без них.

Исходный текст

SKILL.md · MIT
---
name: iphone-duo-capacitor
description: 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.
---

# 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`](https://github.com/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:

```bash
npm install @erkamyaman/capacitor-foldable
npx cap sync
```

```typescript
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](https://github.com/erkamyaman/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`](https://github.com/rdlabo-dev/ionic-theme-ios27/tree/main/packages/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`](https://github.com/rdlabo-dev/ionic-theme-ios27)
adds iOS 27 styling on top.

## What to do, in order

1. Audit every safe-area expression for assumed symmetry. Most bugs die here.
2. Stop caching sizes, and branch on the size you were handed.
3. Give the wide display a real layout rather than a stretched phone one.
4. Add the plugin, and feature-detect the standard APIs so the same build still
   works in a browser that has them.
5. 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.

© mirzaaghazadeh · MIT · mirzaaghazadeh/iphone-duo-skills

Похожие скиллы

Все скиллы по теме «Мобильная разработка» →
capacitor-app-creation capawesome-team Скилл capacitor-app-creation для Claude Code, Codex, Cursor и других платформ проводит агента через создание нового Capacitor-приложения — от скаффолдинга проекта до запуска на iOS и Android. CX Codex +1 1 400установок capacitor-keyboard Cap-go Скилл capacitor-keyboard для Claude Code разбирает поведение экранной клавиатуры в приложениях на Capacitor: режимы resize на iOS, высоты событий, edge-to-edge на Android. Закрывает задачу с полем ввода, которое уезжает под клавиатуру. CX Codex +1 1 100установок cordova-to-capacitor Cap-go Скилл cordova-to-capacitor для Claude Code пошагово переносит приложения с Cordova, PhoneGap и Ionic-Cordova на Capacitor. Включается при обнаружении config.xml, папки platforms или вызовов deviceready. CX Codex +1 826установок capacitor-mcp capawesome-team Настраивает подключение ИИ-агента к публичному MCP-серверу Capacitor от Capawesome. Помогает искать официальную документацию и плагины под нужную версию фреймворка. CX Codex +1 905установок ionic Mindrally Задаёт агенту правила разработки на Ionic: структура проекта, компоненты, стили, ленивая загрузка и работа с Firebase. CX Codex +1 839установок build-iphone-apps Lex Christopherson Скилл build-iphone-apps создаёт нативные приложения для iPhone на Swift через интерфейс командной строки без запуска Xcode. Ведёт разработку от макета до релиза в App Store. CX Codex +1 ★ 1 988звёзд репо

Из того же набора11

Весь набор →
iphone-duo-design-review Скилл iphone-duo-design-review проверяет интерфейсы для складного iPhone Duo во всех позах: закрытой, открытой, книжной, настольной и палатке. Помогает оценить макеты экранов до написания кода. CX Codex +1 986установок iphone-duo-vertical-bars Скилл iphone-duo-vertical-bars подсказывает агенту, как перенести тулбары, навбары и таббары на боковую ось iPhone Duo и что для этого нужно в коде. CX Codex +1 953установок iphone-duo-hinge-and-scenes Скилл iphone-duo-hinge-and-scenes для приложений под iPhone Duo: угол раскрытия шарнира, Split View, несколько сцен и аксессуары сцен вроде CameraCaptureAccessory. CX Codex +1 926установок iphone-duo-camera Скилл iphone-duo-camera строит захват фото и видео на iPhone Duo с двумя фронталками — внутренней под дисплеем и внешней сверхширокой. Переключает камеры при открытии, закрытии и перевороте устройства. CX Codex +1 812установок iphone-duo-dual-pane-patterns Скилл iphone-duo-dual-pane-patterns для Claude Code, Codex, Cursor и других агентов: точные размеры дисплеев iPhone Duo в пикселях и поинтах, формы хинж-коллбэков и паттерны раскладки для каждой позы. CX Codex +1 772установок iphone-duo-react-native Скилл iphone-duo-react-native для Claude Code помогает адаптировать React Native и Expo-приложения к складному iPhone Duo. Он охватывает безопасные отступы, изменение размеров окна и доступ к системным API. CX Codex +1 742установок iphone-duo-games Скилл iphone-duo-games помогает агенту адаптировать игру под складной iPhone Duo: заполнение экрана в любой позе, блокировка ориентации, соотношение сторон вместо чёрных полос. CX Codex +1 693установок iphone-duo-flutter Скилл iphone-duo-flutter помогает адаптировать приложение на Flutter под складной iPhone Duo. Учит обходить ограничения MediaQuery и пробрасывать нативные API через платформенные каналы. CX Codex +1 690установок

Спонсоры проекта

Компании, которые помогают держать аналитику открытой