/duology-design:duo-shared-screenfrom duology-design
Builds shared-screen experiences for two people on one iPhone Duo — two-player games, teaching, customer demos, kid-and-parent apps. Covers seating modes, per-half coordinate spaces, input gating, sensory feedback, and accessibility.
Ships in duology-design. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Two people, one phone. iPhone Duo is big enough for two people at once, one half each: on the inner display, and for simple tasks on the outer display too. This skill says when that works and how to build it so neither person gets in the other's way. Neighbouring skills: duo-layout (EvenSplit, FoldSplitLayout, reserved regions), duo-continuity (state through a fold), duo-patterns (one person, more room).
Labels: measured means we ran it in a probe app with UI tests on the iPhone Duo simulator (Xcode 27.1, iOS 27.1). Those runs used a clone of the simulator that started closed: the outer display, a 466 × 678 pt window. Unverified means we could not confirm it. We found no Apple guidance on two people sharing one screen (we read the HIG iPhone Duo page, the developer overview and the six iPhone Duo Tech Talks). The rules below apply Apple's general rules, linked inline, plus what we measured.
| Fits | Each half shows |
|---|---|
| Two-player games: races, board games, quizzes | each player's board, controls and score |
| Teaching: tutor and learner | tutor: the answer and the controls; learner: the exercise |
| Showing a customer a quote, plan or choice | staff: editing; customer: a read-only summary and one confirm |
| Kid and parent | parent: settings and stop; kid: big, simple targets |
Don't use it for anything private: both people can read both halves. Do sign-in, payment and long typing before or after the shared part, upright, by the phone's owner. Details for each case: references/use-cases.md.
No API tells you how people sit. There is no posture API; the hinge reports only a status (closed, partly open, fully open) and an angle (api-index). So let people choose, and remember the choice.
| Seating | How people sit | What the halves do |
|---|---|---|
.sameWay | side by side, both looking from one edge | nothing turns |
.faceToFace | across a phone lying flat (Apple: "placed down on a surface", HIG) | each half turns so its top edge sits on the seam |
"Face to face" is Duology's word. It is not what Duology calls tabletop (folded like a laptop on a table): there, both people look from the same side. Face to face assumes the fold runs between the two people, so each owns one panel.
SharedSplit. Not ArrangementView: closed and held sideways it shows only its primary view (measured in duo-layout)..contentShape(Rectangle()) on each half's container, and no gesture on that container: taps and drags go on child views or on a clear layer beside the content. .clipped() hides overflow but doesn't stop it taking the other person's taps (measured).onTapGesture plus DragGesture(minimumDistance:) above zero.first.piece, second.leave.Plain Swift, no UI. Test it on the Mac (references/testing.md). nonisolated keeps these types usable off the main actor in projects that set SWIFT_DEFAULT_ACTOR_ISOLATION to MainActor.
import Foundation
/// The two people sharing the screen. First sits at the top or the left.
nonisolated enum Seat: String, CaseIterable, Identifiable, Sendable {
case first, second
var id: String { rawValue }
var other: Seat { self == .first ? .second : .first }
}
/// How the two people sit. No API can tell, so they choose.
nonisolated enum Facing: String, CaseIterable, Sendable {
case sameWay, faceToFace
/// Clockwise quarter turns for a seat's half. Face to face, each half's
/// top edge ends up on the seam, pointing away from its owner.
func quarterTurns(for seat: Seat, sideBySide: Bool) -> Int {
guard self == .faceToFace else { return 0 }
switch (seat, sideBySide) {
case (.first, false): return 2 // top half: upside down
case (.second, false): return 0 // bottom half: as is
case (.first, true): return 1 // left half: top edge to the right
case (.second, true): return 3 // right half: top edge to the left
}
}
}
/// The one gate every action goes through.
nonisolated struct SeatGate: Equatable, Sendable {
enum Mode: Equatable, Sendable { case together, takeTurns }
var mode: Mode = .together
var isPaused = false
private(set) var current: Seat = .first
func canAct(_ seat: Seat) -> Bool {
!isPaused && (mode == .together || seat == current)
}
/// Call after a seat acts. In turn mode, the other seat goes next.
mutating func finishTurn(of seat: Seat) {
guard mode == .takeTurns, seat == current else { return }
current = seat.other
}
}
SharedSplit is EvenSplit from duo-layout plus seating. Copy it as is. To put the seam exactly on a partly folded phone's fold, see references/split-and-seating.md.
import SwiftUI
extension Seat {
var space: NamedCoordinateSpace { .named(rawValue) } // this seat's half
}
/// Two equal halves that always show: side by side when wider than tall,
/// stacked otherwise. Each half can turn to face its owner.
struct SharedSplit<First: View, Second: View>: View {
var facing: Facing = .sameWay
var spacing: CGFloat = 0
@ViewBuilder var first: () -> First
@ViewBuilder var second: () -> Second
@Environment(\.layoutDirection) private var direction
var body: some View {
GeometryReader { proxy in
let sideBySide = proxy.size.width >= proxy.size.height
let half = sideBySide
? CGSize(width: max(0, (proxy.size.width - spacing) / 2), height: proxy.size.height)
: CGSize(width: proxy.size.width, height: max(0, (proxy.size.height - spacing) / 2))
let layout = sideBySide
? AnyLayout(HStackLayout(spacing: spacing))
: AnyLayout(VStackLayout(spacing: spacing))
layout {
first()
.environment(\.layoutDirection, direction)
.turned(facing.quarterTurns(for: .first, sideBySide: sideBySide))
.frame(width: half.width, height: half.height)
second()
.environment(\.layoutDirection, direction)
.turned(facing.quarterTurns(for: .second, sideBySide: sideBySide))
.frame(width: half.width, height: half.height)
}
// Seats are places at the table: first stays left or top in every
// language. Each half still gets the real direction above.
.environment(\.layoutDirection, .leftToRight)
}
}
}
extension View {
/// Turns this view clockwise by quarter turns inside the space it gets.
/// A sideways turn swaps width and height first, so content lays out for its owner.
func turned(_ quarterTurns: Int) -> some View {
GeometryReader { proxy in
let sideways = quarterTurns % 2 != 0
self
.frame(width: sideways ? proxy.size.height : proxy.size.width,
height: sideways ? proxy.size.width : proxy.size.height)
.rotationEffect(.degrees(Double(quarterTurns) * 90))
.frame(width: proxy.size.width, height: proxy.size.height)
}
}
}
/// One person's half: own coordinate space, own hit area, one accessibility container.
struct SeatHalf<Content: View>: View {
let seat: Seat
let label: String
@ViewBuilder var content: () -> Content
var body: some View {
content()
.frame(maxWidth: .infinity, maxHeight: .infinity)
.contentShape(Rectangle()) // keeps the other half's overflow from taking touches; no gesture here
.coordinateSpace(seat.space)
.clipped() // hides overflow; does not stop touches
.accessibilityElement(children: .contain)
.accessibilityLabel(label)
.accessibilityIdentifier(seat.id)
}
}
Measured on the simulator:
contentShape with no gesture on the half: children kept their own accessibility frames (a piece 64 × 64 pt, a text line 352 × 26 pt). recipe-two-player-game measured contentShape plus a tap gesture on one container: a child's frame became the whole field (382 × 261 pt, not 56 × 56). So no gesture on the half itself.Taps, drags, the gate, haptics, system UI and a one-sided Leave, in one screen. Copy PieceHalf (tap plus drag) and ConfirmInPlaceButton (confirm in place) from references/input.md.
import SwiftUI
struct SharedPlayScreen: View {
@State private var gate = SeatGate()
@State private var scores: [Seat: Int] = [:]
@AppStorage("seating") private var facing: Facing = .sameWay
@AppStorage("haptics") private var hapticsOn = true
@Environment(\.dismiss) private var dismiss
var body: some View {
SharedSplit(facing: facing, spacing: 2) { half(.first) } second: { half(.second) }
.background(Color.secondary)
.persistentSystemOverlays(.hidden) // a request; the system may not honour it
.defersSystemGestures(on: .all) // the first edge swipe goes to the app
.onAppear { UIApplication.shared.isIdleTimerDisabled = true }
.onDisappear { UIApplication.shared.isIdleTimerDisabled = false }
}
private func half(_ seat: Seat) -> some View {
SeatHalf(seat: seat, label: seat == .first ? "Player one" : "Player two") {
ZStack(alignment: .topLeading) {
PieceHalf(seat: seat, canAct: gate.canAct(seat)) { score(seat) }
Text("\(scores[seat, default: 0])")
.font(.largeTitle.monospacedDigit())
.accessibilityIdentifier("\(seat.id).score")
.padding()
if seat == .second { // one seat owns Leave, at its bottom: away from the seam
ConfirmInPlaceButton(title: "Leave", confirmTitle: "Leave?",
systemImage: "xmark", identifier: "second.leave") { dismiss() }
.frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .bottom)
.padding()
}
}
}
.opacity(gate.canAct(seat) ? 1 : 0.5)
.sensoryFeedback(.success, trigger: scores[seat, default: 0]) { old, new in
hapticsOn && new > old
}
}
private func score(_ seat: Seat) {
guard gate.canAct(seat) else { return } // the real gate
scores[seat, default: 0] += 1
gate.finishTurn(of: seat)
}
}
PieceHalf pairs .onTapGesture with DragGesture(minimumDistance: 6, coordinateSpace: seat.space). Measured: a tap counted once and started no drag; a drag counted once and added no tap. Use 0 only on a drawing surface with no taps (DragGesture).rotationEffect turns only your view's drawing (doc). System alerts, sheets and the keyboard keep the interface orientation, so face to face one person reads them upside down, and they cover both halves (not tested on the simulator).persistentSystemOverlays(.hidden) is a preference (doc). Measured: screenshots right after launch still showed the home indicator.SeatHalf does this). Order the halves with accessibilitySortPriority(_:). Code: references/accessibility.md.import XCTest
@MainActor
final class SharedScreenUITests: XCTestCase {
private func element(_ app: XCUIApplication, _ id: String) -> XCUIElement {
app.descendants(matching: .any).matching(identifier: id).firstMatch
}
func testEachSeatScoresOnItsOwnHalf() {
let app = XCUIApplication()
app.launch()
for seat in ["first", "second"] {
let piece = element(app, "\(seat).piece")
XCTAssertTrue(piece.waitForExistence(timeout: 5))
piece.tap()
XCTAssertEqual(element(app, "\(seat).score").label, "1", "\(seat): a tap scores once")
piece.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5))
.press(forDuration: 0.3,
thenDragTo: element(app, seat).coordinate(withNormalizedOffset: CGVector(dx: 0.2, dy: 0.8)))
XCTAssertEqual(element(app, "\(seat).score").label, "2", "\(seat): a drag scores once")
}
}
}
XCUIDevice.shared.orientation did not rotate the app on the cloned Duo simulator. Check the other axis by hand in Device Hub or with a launch switch.Same ideas, typechecked but not run: two half views turned with transform, UIImpactFeedbackGenerator(style:view:) per half, and the view controller's home indicator and edge gesture preferences. Code: references/uikit.md.
SharedSplit, not ArrangementView)..contentShape(Rectangle()), with no gesture on the half itself; drags stay inside the half.references/accessibility.md (opens in a new tab)references/feedback-and-system-ui.md (opens in a new tab)references/input.md (opens in a new tab)references/split-and-seating.md (opens in a new tab)references/testing.md (opens in a new tab)references/uikit.md (opens in a new tab)references/use-cases.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub kimeur/duology --plugin duology-design8 skills in this plugin
/duo-accessibilityMakes iPhone Duo apps work with VoiceOver, Dynamic Type, Reduce Motion, Increase Contrast, hardware keyboards, Switch Control and Voice Control on both displays. Use it when VoiceOver reads two panes row by row or loses its place after the phone folds or unfolds, when text truncates or clips on the 5.4-inch outer display at large text sizes, when a hinge effect or resize animation ignores Reduce Motion, when colours fail contrast, when keyboard shortcuts or focus don't work, or when you add accessibility labels, identifiers or audits. Covers accessibilityElement(children: .contain), accessibilitySortPriority, AccessibilityFocusState with a delayed move after a size-class change, AnyLayout and ViewThatFits reflow with isAccessibilitySize, ScaledMetric, accessibilityReduceMotion with onHingeChange, colorSchemeContrast, keyboardShortcut, accessibilityInputLabels, modifiers before .position, Accessibility Inspector, performAccessibilityAudit and XCUIDevice voiceOverService UI tests on the iPhone Duo simulator./duo-design-reviewReviews screenshots, simulator captures and Figma frames for iPhone Duo, Apple's foldable, against a 15-point checklist (letterboxing, state lost on fold and unfold, sizing from UIScreen.main, text or buttons in the fold via reservedRegions .division and .occlusion, odd grid columns, vertical toolbars with symbols and titles, tabletop and book layouts with ArrangementView overlay, camera preview rotation, outer display feature parity, multiple windows with UIWindowScene.ActivationAction, transitions, 44 pt touch targets, hardware keyboard, drag and drop) and writes findings with severity, rule, where and fix. Use it when someone asks to critique, audit or review a design, mockup, concept or Dribbble shot for the foldable, the outer display or the inner display, or asks what breaks when the phone is closed, open, partly folded like a book, propped on a table, in Split View or under Picture in Picture./duo-design-systemDesign tokens and a drop-in SwiftUI token module for iPhone Duo, Apple's foldable, that adapt by size class instead of by device. Covers a 4-point spacing scale, system margins and gutters with a wider gap at the fold, even-column layout grids (4 compact, 8 regular) with spans, one type scale with Dynamic Type for the 5.4-inch outer and 7.6-inch inner display, Liquid Glass usage and legibility (glassEffect, GlassEffectContainer, regular vs clear, dimming, tint), ConcentricRectangle and containerShape for corners, 44 pt touch targets, and light, dark and Increase Contrast colours with a contrast check. Use when you set up spacing, grids, fonts, corners, glass or colours, build a design system, theme or tokens for an iPhone Duo app, or turn a two-frame Figma design into code./duo-ergonomicsPuts controls where hands can reach them on iPhone Duo, Apple's foldable iPhone: one-handed on the closed phone, two hands on the open display, the book grip, and hands-free on a table. Use it when you decide where a primary action, a floating button, player controls or a custom control strip goes; when buttons sit at the top centre of the open display, on the fold or out of thumb reach; when you check thumb zones or reachability; when you design for left-handed people or right-to-left languages; or when touch targets are small. Covers why bars move to the side edge, toolbarVerticalEdge and verticalBarEdge (read them; right to left changes the name, not the side), visibilityPriority for bottom-bar actions, a ThumbCorner modifier for floating controls, an in-app hand preference, ArrangementView with the overlay style to put controls in the bottom half, reservedRegions(kind: .division) to keep targets off the fold, and 44 pt hit regions with frame(minWidth:minHeight:) and contentShape on the label./duo-patternsPicks and builds layout patterns for iPhone Duo, Apple's foldable iPhone, in SwiftUI - list-detail, supporting pane, two-page, dual view, extended canvas, feed reflow with even columns, tabs to sidebar, and displacement off the fold. Use it when you design or fix a screen for the outer display and the inner display, when content or buttons land in the fold, or when choosing between NavigationSplitView, inspector, ArrangementView (split and overlay styles), TabView with sidebarAdaptable and defaultTabBarPlacement, and reserved regions (division, occlusion, includeInactive)./duo-posturesDesigns iPhone Duo screens for every pose Apple shows: closed on the outer display, open flat (wide or tall), partly folded like a book, propped on a table like a laptop (tabletop), standing like a tent, and open and turned around (flipped, rear cameras facing the user). Use it when a screen must work half folded, when you build a tabletop media player or video call (video on top, the same controls below the fold), a book-pose layout with two regions, or a hinge effect. There is no posture API: read size classes and the .division reserved region (active only when partly folded) with FoldGeometry and FoldRegionsLayout, and keep onHingeChange and UIHingeInteraction for effects, with Reduce Motion and accessibility rules.Other plugins' skills for the same job