Skip to content
building-apple-platform-products logo

Building Apple Platform Products

building-apple-platform-products

Builds, tests, and archives Swift packages and Xcode projects for Apple platforms. Use when running xcodebuild, swift build, or swift test commands, discovering schemes and targets, or selecting simulator destinations for iOS, macOS, tvOS, watchOS, or visionOS.

SKILL.md

Full skill instructions

Building Apple Platform Products

Build, test, and archive Swift packages and Xcode projects for Apple platforms.

When to Use This Skill

Use this skill when you need to:

  • Build an iOS, macOS, tvOS, watchOS, or visionOS app
  • Build a Swift package
  • Run unit tests or UI tests
  • Create an archive for distribution
  • Discover project structure (schemes, targets, configurations)

Tool Selection

Project TypePrimary ToolWhen to Use
Standalone Package.swiftswift buildLibraries, CLI tools, cross-platform Swift (no .xcodeproj)
.xcworkspacexcodebuild -workspaceCocoaPods or multi-project setups
.xcodeprojxcodebuildStandard Xcode projects (including those with SPM dependencies)

Important: The swift build / swift test commands only work for standalone Swift packages. If a Swift package is embedded as a submodule within an Xcode project, you must use xcodebuild with the appropriate scheme—the Swift CLI cannot orchestrate builds in that context.

Project Discovery

Before building, discover the project structure:

# Find what project files exist
ls Package.swift *.xcworkspace *.xcodeproj 2>/​dev/​null

# List schemes and targets (auto-detects project)
xcodebuild -list

# Describe package (standalone SPM only)
swift package describe

Note: When an Xcode project references a local Swift package, each package target gets its own scheme (named after the target, not the package). Use these schemes to build individual targets without building the entire app.

For mixed projects, shared schemes, or detailed output parsing, see project-discovery.md.

Swift Package Manager Commands

Important: These commands only work for standalone Swift packages, not Swift Package Manager submodules in Xcode projects.

GoalCommand
Build (debug)swift build
Build (release)swift build -c release
Run executableswift run [<target>]
Run testsswift test
Run specific testswift test --filter <TestClass.testMethod>
Show binary pathswift build --show-bin-path
Cleanswift package clean
Initializeswift package init [--type library|executable]

For cross-compilation, Package.swift syntax, or dependency management, see swift-package-manager.md.

xcodebuild Commands

Command structure: xcodebuild [action] -scheme <name> [-workspace|-project] [options] [BUILD_SETTING=value]

GoalCommand
List schemesxcodebuild -list
Buildxcodebuild build -scheme <name>
Testxcodebuild test -scheme <name> -destination '<spec>'
Build for testingxcodebuild build-for-testing -scheme <name> -destination '<spec>'
Test without buildxcodebuild test-without-building -scheme <name> -destination '<spec>'
Archivexcodebuild archive -scheme <name> -archivePath <path>.xcarchive
Cleanxcodebuild clean -scheme <name>

Required: -scheme is always required. Add -workspace or -project when multiple exist. For tests: -destination is required for iOS/​tvOS/​watchOS/​visionOS targets.

For build settings, SDK selection, or CI configuration, see xcodebuild-basics.md.

Common Destinations

PlatformDestination Specifier
macOS'platform=macOS'
iOS Simulator'platform=iOS Simulator,name=iPhone 17'
iOS Device'platform=iOS,id=<UDID>'
tvOS Simulator'platform=tvOS Simulator,name=Apple TV'
watchOS Simulator'platform=watchOS Simulator,name=Apple Watch Series 11 (46mm)'
visionOS Simulator'platform=visionOS Simulator,name=Apple Vision Pro'
Generic (build only)'generic/​platform=iOS'

Note: Simulator names change with each Xcode release. Always verify available simulators:

xcrun simctl list devices available

For all platforms, multiple destinations, or troubleshooting destination errors, see destinations.md.

Reference Files

TopicFileWhen to Read
Project Discoveryproject-discovery.mdMixed projects, shared schemes
Swift Package Managerswift-package-manager.mdCross-compilation, Package.swift syntax
xcodebuild Basicsxcodebuild-basics.mdBuild settings, SDK selection
Destinationsdestinations.mdAll platforms, multiple destinations
Testingtesting.mdTest filtering, parallel execution, coverage
Archivingarchiving.mdArchive creation
Troubleshootingtroubleshooting.mdBuild/​test failures, error recovery

Common Pitfalls

  1. swift build with Xcode submodules: Only works for standalone packages. Use xcodebuild with the package's scheme instead.
  2. Missing destination for iOS: Use -destination 'generic/​platform=iOS' for builds, or specify a simulator for tests.
  3. Unnecessary workspace flag: Only use -workspace for CocoaPods or multi-project setups. Standard projects with SPM dependencies just use .xcodeproj.
  4. Case-sensitive scheme names: Run xcodebuild -list to see exact scheme names.
  5. Outdated simulator names: Names change with Xcode versions. Run xcrun simctl list devices available.
  6. Code signing errors: Add CODE_SIGNING_ALLOWED=NO for builds that don't require signing.

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View