Index of every page on this site: llms.txt
All skills
kimeur avatar

/duo-ergonomics

@cffd95d
by Gazouzi Marouanekimeur/duology46 stars
2
Run it yourself

Puts 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.

Use this Skill: https://skilld.dev/gh/kimeur/duology/duo-ergonomics

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencestarget-audit.md

≈1.5k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Target audit

Depth for ../SKILL.md, section 4. Two ways to find controls that are too small, on the fold or out of reach: a debug modifier that logs from the running app, and a screenshot review.

Log small targets and targets on the fold

Attach auditTarget(_:) to each custom control while you lay out a screen. In debug builds it prints a line for any control under 44 pt on either side, and for any control that touches an active fold.

import SwiftUI

/// What the audit learned about one control.
@available(iOS 27.1, *)
nonisolated struct TargetReport: Equatable, Sendable {
    var size: CGSize
    var touchesFold: Bool
}

@available(iOS 27.1, *)
extension View {
    /// Debug check: logs a control smaller than 44 x 44 pt or touching an active fold.
    func auditTarget(_ name: String) -> some View {
        onGeometryChange(for: TargetReport.self) { proxy in
            let bounds = CGRect(origin: .zero, size: proxy.size)
            // Frames come in this view's own coordinates. Check isActive yourself (see Limits).
            let folds = proxy.reservedRegions(kind: .division)
            return TargetReport(size: proxy.size,
                                touchesFold: folds.contains { $0.isActive && $0.frame.intersects(bounds) })
        } action: { report in
            #if DEBUG
            if report.size.width < 44 || report.size.height < 44 {
                print("TARGET \(name): \(Int(report.size.width)) x \(Int(report.size.height)) pt, under 44 pt")
            }
            if report.touchesFold { print("TARGET \(name): touches the fold") }
            #endif
        }
    }
}

Use it like this, then switch poses in Device Hub and read the console:

import SwiftUI

// requires: TargetReport, auditTarget(_:) (above)

@available(iOS 27.1, *)
struct RecorderControls: View {
    var body: some View {
        HStack(spacing: 24) {
            Button("Record", systemImage: "record.circle") {}
                .auditTarget("record")
            Button("Markers", systemImage: "flag") {}
                .auditTarget("markers")
        }
        .labelStyle(.iconOnly)
        .font(.title)
    }
}

Attach it straight to the Button, before any .frame or .background outside it. Those grow the layout, not the hit region, so an audit placed after them reports the wrong size. Size the target with a frame and contentShape on the label instead (SKILL.md, section 4).

Keep nonisolated on TargetReport. In a new Xcode 27.1 app, SWIFT_DEFAULT_ACTOR_ISOLATION is MainActor, which makes the struct's Equatable conformance main-actor isolated, and onGeometryChange then rejects it (the same fix as FoldGeometry in duo-patterns).

What it printed

Measured on the closed simulator (iOS 27.1, portrait, 18 Oct 2026):

TARGET tiny: 22 x 13 pt, under 44 pt
TARGET centre: 103 x 34 pt, under 44 pt

tiny was a plain text button in .caption2. centre was a .borderedProminent button at the default .regular control size. Both are smaller than 44 pt in layout. Apple doesn't document whether system buttons accept taps outside their frame, so read a system button's line as "check it", and a custom control's line as "fix it".

Limits

  • The fold line is unverified. We could not change poses in this run, so we never saw a control on an active fold. The closed phone has no fold.
  • On the closed phone, the region query on a 382 × 562 pt view also returned the two camera and status bar regions in the bar strip, outside the view's frame. Apple's doc says the query returns regions that intersect the view. That is why the code tests intersects(bounds) itself instead of trusting a non-empty result.
  • Apple's doc also says the default query returns regions whether or not they are active. duo-layout measured the opposite on the open phone: inactive regions came back only with .includeInactive (API index marks this unverified). The code tests isActive itself, so it is right either way.
  • The audit measures the view it is attached to. Attach it to the button, not to a stack around several buttons.
  • Remove the calls, or keep them inside #if DEBUG, before you ship. The geometry callback still runs in release builds.

Review screenshots

Take screenshots with xcrun simctl io <UDID> screenshot --display=primary outer.png (closed) and --display=primary-1 inner.png (open). They come out at 3x, so multiply points by 3.

What to check Where, in pixels Source
Hit regions 44 pt is 132 px on each side HIG, Buttons
Space between bezeled targets about 12 pt, 36 px HIG, Accessibility
Fold band, held wide (book) x 1365–1485 px, full height measured in duo-patterns (x 455–495 pt)
Fold band, held tall (tabletop) y 1365–1485 px, full width measured in duo-patterns (y 455–495 pt)
Top centre, held wide x 951–1902 px, y 0–1005 px judgement: the middle third of 951 pt, the top half of 669 pt
Bar strip, closed portrait, left to right x 1146–1398 px measured: 84 pt trailing inset in a 466 pt window

Flag, most serious first:

  1. Anything interactive in a fold band when the phone is partly folded.
  2. A frequent action in the top centre of the open display.
  3. A frequent control under 132 × 132 px.
  4. A floating button far from the bar's side, or touching the bar's items.
  5. A tabletop layout with controls in the top half.

duo-design-review turns these into findings: R4 (nothing interactive in the fold), R7 (tabletop and book layouts) and R13 (touch targets of 44 pt).

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts1mo3 checks · Risk SAFE
  • Gen Agent Trust Hub1mo

    The duo-ergonomics skill provides design and development guidance for foldable device interfaces. It includes UI layout patterns, touch target specifications, and auditing tools for developers using SwiftUI and UIKit. No malicious patterns or security risks were identified.

  • Socket1mo

    No alerts

  • Snyk1mo

    Risk: LOW · No issues

Signed by skilld at cffd95d. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 weeks ago.

Activeupdated last month
Other metadata
metadata
{
  "verified": "Xcode 27.1 (27A9275), iOS 27.1 simulator, device: no",
  "sources": "https://github.com/Kimeur/duology/blob/main/reference/sources.md"
}

README badge

README badge for kimeur/duology/duo-ergonomics