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

iphone-duo-hinge-and-scenes — скилл для Claude Code

Скилл iphone-duo-hinge-and-scenes для приложений под iPhone Duo: угол раскрытия шарнира, Split View, несколько сцен и аксессуары сцен вроде CameraCaptureAccessory.

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

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

Что делает iphone-duo-hinge-and-scenes

Скилл описывает три возможности iPhone Duo, которых нет у других iPhone. Первая — реакция на шарнир: onHingeChange в SwiftUI или UIHingeInteraction в UIKit дают грубый статус (закрыт, приоткрыт, полностью открыт) и непрерывный угол обновления. Угол стоит использовать для эффектов и взаимодействий, а не для раскладки — раскладку от угла поведёт во время складывания и сломает на устройствах без шарнира.

Вторая возможность — Split View, в котором участвуют все приложения. Система отдаёт size classes и геометрию сцены; если приложение уже умеет ресайз на iPad, большая часть работы сделана. Стоит протестировать асимметричные safe area: вертикальный бар может оказаться с любой стороны, смотря какую половину экрана заняло приложение.

Третья — множественные сцены и scene accessories. На внешнем дисплее нельзя создать новое окно, поэтому запрос сцены, который на iPad всегда проходил, здесь может упасть — нужна обработка ошибок. Для камеры есть CameraCaptureAccessory (SwiftUI) и UISceneAccessory.cameraCapture (UIKit): внешний дисплей показывает скрипт или отсчёт, пока съёмка идёт на внутреннем. Типы у фреймворков различаются: угол в SwiftUI — Angle, в UIKit — CGFloat в радианах, а UIKit-шного типа CameraCaptureAccessory вообще нет.

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

  • читать угол раскрытия шарнира и реагировать на него
  • добавить поддержку Split View в приложение
  • обработать отказ создания сцены на внешнем дисплее
  • вывести контент камеры на внешний дисплей
  • спрятать кнопку, когда аксессуар сцены недоступен

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

  • Добавь реакцию на шарнир через onHingeChange и сбрасывай эффект, когда устройство раскрыто полностью
  • Проверь, что приложение в Split View корректно работает на обеих половинах экрана
  • Зарегистрируй CameraCaptureAccessory на том же view, что и превью камеры

Как установить iphone-duo-hinge-and-scenes

1Через Skills CLI (Vercel)

npx skills add mirzaaghazadeh/iphone-duo-skills --skill iphone-duo-hinge-and-scenes -a claude-code

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

~/.claude/skills/iphone-duo-hinge-and-scenes/SKILL.md

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

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

Вопросы об iphone-duo-hinge-and-scenes

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

Выполни npx skills add mirzaaghazadeh/iphone-duo-skills --skill iphone-duo-hinge-and-scenes -a claude-code. После установки скилл будет лежать в ~/.claude/skills/iphone-duo-hinge-and-scenes/SKILL.md.

Что делает iphone-duo-hinge-and-scenes?

Показывает, как использовать угол шарнира iPhone Duo для эффектов, как поддерживать Split View и несколько сцен, а также как подключать scene accessories вроде CameraCaptureAccessory для внешнего дисплея.

Чем отличаются SwiftUI и UIKit в работе с шарниром?

Угол в SwiftUI — это Angle, в UIKit — CGFloat в радианах. Статус в SwiftUI — структура DeviceHinge.Status (для switch нужен default), в UIKit — enum UIHinge.Status с дополнительным случаем .unknown.

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

SKILL.md · MIT
---
name: iphone-duo-hinge-and-scenes
description: 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 (SwiftUI) and UISceneAccessory.cameraCapture (UIKit). Use when building fold-driven effects, multi-window support, or dual-display experiences.
---

# Hinge, multitasking and scenes

Three capabilities that are unique to iPhone Duo, in rising order of ambition:
reacting to the hinge, participating in Split View, and putting your own UI on
both displays at once.

## The hinge

The system itself responds to the hinge — the wallpaper reacts to the angle with
a zoom effect as the device opens. Apps can read the same signal.

Use the `onHingeChange` modifier in SwiftUI, or `UIHingeInteraction` in UIKit.
Both give you:

- a coarse **status** — closed, partially open, fully open
- a **continuous angle**, updated live

`onHingeChange` hands your closure the previous and current hinge context.
`UIHingeInteraction` hands its handler the interaction and an `Update` instead,
and also fires when the view moves between hierarchies.

Watch the types — they differ between frameworks:

- SwiftUI's angle is an `Angle`; **UIKit's is a `CGFloat` in radians**.
- SwiftUI's `DeviceHinge.Status` is a struct (a `switch` needs `default`);
  UIKit's `UIHinge.Status` is an enum with a fourth case, **`.unknown`**.
- The system decides the status from the angle *and* device orientation, so
  don't recompute it from thresholds. Update rate and precision are system
  policy — don't assume a frequency.

Full signatures, a reusable normaliser, and effect patterns are in
`../iphone-duo-dual-pane-patterns/SKILL.md`.

Two things to check before using the value:

1. **Is there a hinge at all?** A `nil` hinge means the app is running on a
   device without one. Same binary, most devices.
2. **Is the device in a state you care about?** Usually you only want updates
   while partially open — and you need an `else` branch that resets whatever the
   angle was driving, so the effect doesn't stick at a stale value once the user
   opens the device flat.

Then map the angle to your parameter and update state.

### What the hinge is for

**Interactions and effects.** The angle is a live, continuous input stream — it
behaves like a sensor, and it suits things that respond continuously. Driving a
pitch bend from the fold angle, the way a whammy bar works, is the right shape of
idea.

**Not layout.** Do not lay out views from the hinge angle. Layout has proper
tools that are declarative, testable and correct on devices with no hinge:
arrangements and reserved regions, in
`../iphone-duo-adaptive-layout/SKILL.md`. Reaching for the angle here produces
layout that thrashes during the fold and breaks everywhere else.

## Split View multitasking

**Every app participates.** Two apps sit side by side, created with the familiar
home gesture — drag an app to one side and drop it. There's a second layout too,
stacking video and apps together when Picture-in-Picture is pinned. Your app
handles both identically.

If the app already supports resizing on iPad or under iPhone mirroring, it is
most of the way there. The system gives you size classes and scene geometry to
make layout decisions from; the general guidance in
`../iphone-duo-readiness/SKILL.md` applies unchanged.

The detail worth testing: in Split View, vertically laid out bar content can
appear on **either** side of your app, depending on which half you occupy. Drag
the app to both sides in Device Hub and check that asymmetric safe area handling
holds up.

## Multiple scenes

iPhone Duo is the first iPhone to support **multiple simultaneous instances of an
app's UI**. If the app already supports this on iPad, it works here too.

One behavior is genuinely new, though:

**New windows cannot be created on the outer display.** That is reserved for the
inner display, and the availability changes as the user opens and closes the
device. This dynamic availability doesn't exist on iPad.

Consequences:

- **Handle errors when requesting new scenes.** A request that always succeeded
  on iPad can now fail.
- **Prefer `UIWindowSceneActivation`**, which automatically hides itself when new
  windows aren't available — so users never tap an affordance that can't work.

## Scene accessories

Scene accessories pair additional content with your app's main UI on another
display. They aren't Duo-specific — the same mechanism backs using an iPhone as a
controller for a game on an external display — but iPhone Duo gives every user
two displays to work with.

The system controls availability dynamically. Accessories are enabled by default
and can be toggled at any time, so **observe availability rather than assuming
it**: use the `onAvailabilityChange(perform:)` modifier in SwiftUI, or read
`isAvailable` on the `UISceneAccessoryRegistration` in UIKit — it's observable
in `updateProperties()` and `layoutSubviews()`. Reflect the current state in
your UI (disabling a toggle button when the accessory can't be shown, for
instance).

### CameraCaptureAccessory

For camera apps, a camera capture accessory puts UI on the **outer** display —
which faces the same way as the camera — while the capture interface stays on
the **inner** one. The person in front of the lens gets something to look at: a
script to read, a countdown before recording starts, how much of them the camera
sees, or something to entertain a child.

The system decides when and where to present it. Your app passes no display,
capture session or camera; the system finds the active capture session itself.
Presentation needs the app **full screen on the inner display**, **in the
foreground**, with an **active capture session**. Treat the content as an
enhancement: the capture interface must work when nothing appears, and keep
every essential control there. The outer display accepts touch, which suits one
small capture task — tapping a preview to focus — not a second interface.

**Register the accessory on the same view as your camera UI.** Scoped that way,
it appears and disappears with the camera view, with no lifecycle code. The two
frameworks differ more than the names suggest — UIKit has **no
`CameraCaptureAccessory` type**:

```swift
// SwiftUI
CameraPreview()
    .sceneAccessory {
        CameraCaptureAccessory(isEnabled: $isScriptEnabled) {
            ScriptView(model: script)   // captures the model you already use
        }
        .onAvailabilityChange { showsScriptControls = $0 }
    }
```

```swift
// UIKit, in the camera view controller's viewDidLoad()
let configuration = UISceneConfiguration()
configuration.delegateClass = ScriptSceneDelegate.self
let accessory = UISceneAccessory.cameraCapture(sceneConfiguration: configuration,
                                               userInfo: script)
registration = registerSceneAccessory(accessory)   // hold it strongly

// Turning it off, and hiding controls (in updateProperties())
registration?.isEnabled = isScriptEnabled
scriptControls.isHidden = !(registration?.isAvailable ?? false)
```

In UIKit the scene delegate gets the model back from
`connectionOptions.sceneAccessoryUserInfo`. Keep your own strong reference to
it — `userInfo` identifies the object to the scene, it doesn't store it. The
system gives that scene the role `.windowCameraCaptureAccessory`; there's no
scene-manifest entry to add, and one would have no effect.

**Share state rather than sending messages.** Give the accessory the model the
capture interface already reads. A control the subject taps on the outer display
then changes what the person holding the device sees, with nothing in between.

**Turn it off rather than unregistering.** A toolbar toggle bound to `isEnabled`
is the natural control; disable or hide it while the accessory is unavailable.
Unregister only when the app stops offering the content. Availability changes
for reasons outside the app: the system presents only the **top-most**
registration of a kind, so navigating to a view that registers its own makes the
previous one unavailable until you go back, and content goes away when capture
stops, the app leaves the foreground, or the device folds closed. Accessories of
different kinds never compete — slides on an external display and capture
content on the outer display can run at once.

Simulator has no camera. Build the accessory from ordinary views so previews can
check its layout, then test presentation on a device.

Camera specifics — which physical camera is streaming, and which way it is
actually facing once two displays are involved — are in
`../iphone-duo-camera/SKILL.md`. That question gets genuinely subtle, and the
direction coordinator exists to answer it.

## Checklist

1. Support resizing first. Split View correctness follows from it.
2. Test the app on both sides of a Split View, in every pose.
3. If the app supports multiple windows, handle scene-request failure and adopt
   `UIWindowSceneActivation`.
4. Consider whether a hinge-driven effect genuinely improves the app — then guard
   for `nil` hinge and reset state when the device leaves the range you care
   about.
5. For camera apps, evaluate whether a camera capture accessory on the outer
   display would help the person in front of the lens — `CameraCaptureAccessory`
   in SwiftUI, `UISceneAccessory.cameraCapture` in UIKit — and test it on a
   device.

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

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

Все скиллы по теме «Мобильная разработка» →
build-iphone-apps Lex Christopherson Скилл build-iphone-apps создаёт нативные приложения для iPhone на Swift через интерфейс командной строки без запуска Xcode. Ведёт разработку от макета до релиза в App Store. CX Codex +1 ★ 1 988звёзд репо sentry-cocoa-sdk getsentry Скилл sentry-cocoa-sdk проводит через полную настройку Sentry в iOS, macOS, tvOS, watchOS и visionOS: сканирует проект, предлагает набор функций и ведёт по шагам установки. CX Codex +1 3 700установок ios-hig-design wondelai Скилл ios-hig-design для Claude Code и других платформ проектирует нативные iOS-интерфейсы по Human Interface Guidelines Apple. Покрывает Safe Areas, типографику, цвет, навигацию и SF Symbols. CX Codex +1 9 200установок liquid-glass-design affaan-m Скилл liquid-glass-design для Claude Code подсказывает, как собирать интерфейсы в стиле Liquid Glass из iOS 26. Описывает паттерны для SwiftUI, UIKit и WidgetKit под iOS 26+. CX Codex +1 7 300установок ios-accessibility dpearson2699 Скилл ios-accessibility помогает настраивать доступность в приложениях под iOS и macOS, проверяя разметку для экранных дикторов и системные параметры интерфейса. Пригодится при подготовке релиза и аудите компонентов. CX Codex +1 5 400установок swiftui-uikit-interop dpearson2699 Скилл swiftui-uikit-interop помогает связать интерфейсы UIKit и SwiftUI без путаницы с жизненным циклом и потерей данных в общих состояниях. CX Codex +1 4 400установок

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

Весь набор →
iphone-duo-readiness Скилл iphone-duo-readiness для аудита и адаптации iOS-приложений под складной iPhone Duo. Помогает найти жёстко заданные размеры экрана, устаревшие вызовы UIScreen и ошибки вёрстки при переходе на iOS 27.1 SDK. CX Codex +1 1 100установок iphone-duo-adaptive-layout Скилл iphone-duo-adaptive-layout для Claude Code учит агента строить интерфейсы с учётом сгиба iPhone Duo: резервные области, вытеснение контента, контейнеры split и overlay. Прячет кнопки и текст от изгиба дисплея. CX Codex +1 1 000установок 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-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установок

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

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