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

/duo-setup

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

Sets up a Mac to build, run and test apps for iPhone Duo, the foldable iPhone with an outer display and an inner display, covering Xcode 27.1 next to an older Xcode with DEVELOPER_DIR (no sudo xcode-select), xcodebuild -version, the iOS 27.1 SDK and runtime, the iPhone Duo simulator in Device Hub (xcrun simctl create/bootstatus, a screenshot of each display, the Closed / Partially Open / Open poses and the fold angle), Xcode's MCP server for Claude Code (xcrun mcpbridge, MCP_XCODE_PID, xcrun agent skills export) and project settings (IPHONEOS_DEPLOYMENT_TARGET, SWIFT_VERSION 6, SWIFT_DEFAULT_ACTOR_ISOLATION MainActor, SWIFT_APPROACHABLE_CONCURRENCY, synchronized folders). Use it when the Mac or project isn't ready for iPhone Duo work (duo-start or /duo-doctor sends you here), when /duo-doctor fails, when xcodebuild picks the wrong Xcode, when the Duo simulator, iOS 27.1 runtime or hinge pose is missing, or when Claude Code can't reach Xcode.

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

Nothing lands on disk. Nothing to clean up.

Fork this Skill

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

referencesproject-settings.md

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

Project settings for an iPhone Duo app

The build settings and project format Duology recommends, why, and how to check them.

Checked on 16 October 2026 with Xcode 27.1 (27A9275). The two app-code Swift blocks below typecheck against the iOS 27.1 simulator SDK, and also build inside a test app with Swift 6, MainActor default isolation, approachable concurrency and a deployment target of iOS 26.0. On 17 October we typechecked the test-target block against the same SDK's XCTest. The package manifest builds with xcrun swift build.

SDK first, deployment target second

Two settings sound alike and do different things:

  • The SDK is the one inside the Xcode you build with. It decides how the app behaves on iPhone Duo. Built with the iOS 26 SDK, the app sits at a familiar iPhone size in the middle of the inner display. With the iOS 27 SDK it fills most of it but avoids the status bar. With the iOS 27.1 SDK it goes edge to edge and its toolbars and tab bars turn vertical (Apple: Three steps). Check it with SDK_VERSION in -showBuildSettings.
  • The deployment target (IPHONEOS_DEPLOYMENT_TARGET) is the oldest iOS the app runs on. It decides which APIs you may call without an availability check.

From April 2027, App Store uploads must be built with the iOS 27 SDK or later and target iOS 15 or later (Apple: Submitting). Xcode 27.1 offers deployment targets from iOS 15.0 to 27.1 (DEPLOYMENT_TARGET_SUGGESTED_VALUES in -showBuildSettings), and debugs on devices running iOS 17 or later (release notes).

What Xcode 27.1's new-app template writes

We read the templates inside Xcode 27.1 (Library/Xcode/Templates/Project Templates):

Setting Template value Duology recommends
IPHONEOS_DEPLOYMENT_TARGET latest_iphoneos, a placeholder for the newest iOS the Xcode knows 27.1 for a Duo-first app; lower it on purpose for wider reach
TARGETED_DEVICE_FAMILY 1,2 Keep. It must include 1 (iPhone).
SWIFT_VERSION 5.0 Change to 6.0
SWIFT_DEFAULT_ACTOR_ISOLATION MainActor (app targets only; test targets get no value) Keep. See Test targets before you add it to a test target.
SWIFT_APPROACHABLE_CONCURRENCY YES Keep
SWIFT_UPCOMING_FEATURE_MEMBER_IMPORT_VISIBILITY YES Keep
LOCALIZATION_PREFERS_STRING_CATALOGS YES Keep
ENABLE_USER_SCRIPT_SANDBOXING YES Keep
iPhone orientations Portrait, Landscape Left, Landscape Right Keep (see Orientations)

Read a project's real values:

DEVELOPER_DIR=/Applications/Xcode-27.1.app/Contents/Developer xcodebuild -scheme <Scheme> -showBuildSettings 2>/dev/null | grep -E \
  "^ *(SWIFT_VERSION|SWIFT_DEFAULT_ACTOR_ISOLATION|SWIFT_APPROACHABLE_CONCURRENCY|IPHONEOS_DEPLOYMENT_TARGET|TARGETED_DEVICE_FAMILY|SDK_VERSION) ="

To try a value for one build without editing the project, add it to the command, for example xcodebuild ... SWIFT_VERSION=6.0 build. To keep it, change it in the target's Build Settings in Xcode, or edit the matching line in project.pbxproj for every configuration (Debug and Release).

Swift 6 language mode

SWIFT_VERSION = 6.0 turns data races into compile errors. Strict concurrency checking is always complete in Swift 6 mode (Apple: build settings, Apple: Adopting strict concurrency in Swift 6 apps).

Default MainActor isolation

SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor makes unannotated code in the target main-actor isolated (Apple: build settings). UI code and view models need no @MainActor. Code that must run elsewhere opts out:

import Foundation
import Observation

// With SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor, this class is
// main-actor isolated without any annotation. SwiftUI views can own it.
@Observable
final class LibraryModel {
    var titles: [String] = []

    func reload() async {
        titles = await TitleLoader().loadTitles()
    }
}

// Plain logic that must run anywhere (tests on the Mac, background work):
// opt the type out of the default with `nonisolated`.
nonisolated struct TitleLoader: Sendable {
    // With approachable concurrency, a nonisolated async function runs on
    // the caller's actor. `@concurrent` moves the work off the main actor.
    @concurrent
    func loadTitles() async -> [String] {
        (1...3).map { "Title \($0)" }
    }
}

What the compiler says when you forget: a nonisolated function that writes to a property of a default-isolated class fails with "main actor-isolated property ... can not be mutated from a nonisolated context". Fix it by making the type nonisolated too, or by hopping to the main actor.

Test targets

Xcode 27.1's app template sets SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor on the app target only. Its unit and UI test targets keep the default, which is nonisolated. Keep it that way unless the user asks for main-actor tests.

The reason: XCTestCase and its methods are nonisolated. Under MainActor default isolation in Swift 6 mode, every subclass's overrides become main-actor isolated, and the build fails. We typechecked Xcode 27.1's own UI test template that way against the iOS 27.1 simulator SDK. It gave these errors, which tell you the cause:

  • "main actor-isolated instance method 'setUpWithError()' has different actor isolation from nonisolated overridden declaration", and the same for tearDownWithError().
  • "main actor-isolated initializer 'init(invocation:)' has different actor isolation from nonisolated overridden declaration", and the same for init(selector:) and init().

Marking only the overrides nonisolated still leaves the initializer errors. The unit test template's XCTestCase class fails the same way. In Swift 5 mode the UI test template compiles without errors.

If a test target must use MainActor default isolation, mark each XCTestCase subclass nonisolated and keep @MainActor on tests that drive the UI:

import XCTest

// Test target built with SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor:
// opt the XCTestCase subclass out, and keep @MainActor on UI tests.
nonisolated final class MyAppUITests: XCTestCase {
    override func setUpWithError() throws {
        continueAfterFailure = false
    }

    @MainActor
    func testLaunch() throws {
        let app = XCUIApplication()
        app.launch()
        XCTAssertTrue(app.wait(for: .runningForeground, timeout: 10))
    }
}

This class typechecks in Swift 5 and Swift 6 mode, with and without MainActor default isolation and approachable concurrency.

Approachable concurrency

SWIFT_APPROACHABLE_CONCURRENCY = YES turns on five upcoming features: DisableOutwardActorInference, GlobalActorIsolatedTypesUsability, InferIsolatedConformances, InferSendableFromCaptures and NonisolatedNonsendingByDefault (Apple: build settings).

In Swift 6 mode, three of them are already on; the Swift 6.4 compiler warns "already enabled" when you pass them. So, next to SWIFT_VERSION = 6.0, the setting adds two behaviours:

  • NonisolatedNonsendingByDefault: a nonisolated async function runs on the caller's actor. Mark it @concurrent to run it on the shared pool.
  • InferIsolatedConformances: a global-actor type's protocol conformances are isolated to that same actor, unless you mark them nonisolated.

Deployment target and availability

Arrangements, reserved regions, the hinge and the vertical-bar APIs are iOS 27.1 (Duology API index). Some bar and sheet APIs, such as presentationPlacement(_:) and defaultTabBarPlacement(_:), are iOS 27.0.

  • Deployment target 27.1: call them directly.
  • Lower target: gate every one. Without the gate the build fails, for example "'onHingeChange(isEnabled:_:)' is only available in iOS 27.1 or newer".
import SwiftUI

// Deployment target below iOS 27.1: gate every Duo API with #available.
struct NotesScreen: View {
    var body: some View {
        if #available(iOS 27.1, *) {
            ArrangementView {
                NotesList()
            } secondary: {
                NoteDetail()
            }
        } else {
            HStack(spacing: 0) {
                NotesList()
                NoteDetail()
            }
        }
    }
}

struct NotesList: View {
    var body: some View {
        List(["Groceries", "Ideas"], id: \.self) { Text($0) }
    }
}

struct NoteDetail: View {
    var body: some View {
        Text("Pick a note")
    }
}

The else branch stands for whatever layout the app used before. Choosing the layout itself is duo-layout's job.

Two Xcode 27.1 known issues for apps that also build for Mac Catalyst (release notes): code using iOS 27.1-only APIs fails to compile for Catalyst, so wrap it in #if !targetEnvironment(macCatalyst); and a target of iOS 27.1 shows no Mac Catalyst run destination until you add a Mac Catalyst 27.0 minimum deployment.

Swift packages

Packages don't read the app's build settings. Set the same choices in Package.swift. With swift-tools-version: 6.2, targets build in Swift 6 mode, and .defaultIsolation(MainActor.self) sets the default isolation per target:

// swift-tools-version: 6.2
import PackageDescription

let package = Package(
    name: "DuoEngine",
    platforms: [.iOS(.v26), .macOS(.v26)],
    products: [.library(name: "DuoEngine", targets: ["DuoEngine"])],
    targets: [
        // Pure logic: no default isolation, so tests run anywhere.
        .target(name: "DuoEngine"),
        .target(name: "DuoUI", swiftSettings: [.defaultIsolation(MainActor.self)]),
        .testTarget(name: "DuoEngineTests", dependencies: ["DuoEngine"]),
    ]
)

We built this package and ran its tests with xcrun swift test on the Mac. Keeping game rules or business logic in a package like DuoEngine lets you test it without the simulator.

Synchronized folders

Xcode can map a folder on disk straight into the project. Apple calls these folders, as opposed to groups; projects that use them have objectVersion = 77 in project.pbxproj. Adding or removing a file on disk updates the project with no edit to project.pbxproj, which also means fewer merge conflicts (Apple: Managing files and folders). For an agent, that means a new Swift file in the folder is part of the target at the next build.

Check:

grep -E "objectVersion|isa = PBXFileSystemSynchronizedRootGroup" <App>.xcodeproj/project.pbxproj

Pass when you see objectVersion = 77; and at least one PBXFileSystemSynchronizedRootGroup.

  • Older project: the user selects the groups in the Project navigator, Control-clicks and chooses Convert to Folder. Xcode converts only groups that match the folders on disk, and lists the rest.
  • To keep a file out of a target, change its target membership in the File inspector. Xcode records that as an exception set (PBXFileSystemSynchronizedBuildFileExceptionSet) in the project file.
  • Xcode 27 also reads a new JSON project file, .xcproj, which becomes the default in Xcode 27.2 (Apple: project file format). Only Xcode 27 and later can open it. Keep project.pbxproj while anyone on the team still uses Xcode 26.

Orientations and full screen

  • Keep the template's iPhone orientations. The outer display honours them like any iPhone. The inner display doesn't; there, the app is scaled to fit, Split View included (Tech Talk 111461).
  • Remove UIRequiresFullScreen. Apple deprecated it in iOS 26 (TN3192). Even when it is honoured, the app still resizes when the phone opens or closes (Tech Talk 111461).
  • Never branch on UIScreen.main, the device orientation or userInterfaceIdiom for layout. Use size classes and the view's own geometry. UIScreen.main is deprecated since iOS 26 (Apple: UIScreen.main).

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

    This skill prepares a macOS environment for developing and testing applications for the foldable iPhone Duo. It handles Xcode 27.1 configuration, simulator setup, and the integration of Claude Code with Xcode via the Model Context Protocol (MCP). The skill follows security best practices by avoiding global system modifications (like sudo xcode-select) and requiring explicit user approval for downloads and configuration changes.

  • 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-setup