Claude-skill-registry 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.
git clone https://github.com/majiayu000/claude-skill-registry
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/building-apple-platform-products" ~/.claude/skills/majiayu000-claude-skill-registry-building-apple-platform-products && rm -rf "$T"
skills/data/building-apple-platform-products/SKILL.mdBuilding 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 Type | Primary Tool | When to Use |
|---|---|---|
Standalone | | Libraries, CLI tools, cross-platform Swift (no .xcodeproj) |
| | CocoaPods or multi-project setups |
| | Standard 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.
| Goal | Command |
|---|---|
| Build (debug) | |
| Build (release) | |
| Run executable | |
| Run tests | |
| Run specific test | |
| Show binary path | |
| Clean | |
| Initialize | |
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]
| Goal | Command |
|---|---|
| List schemes | |
| Build | |
| Test | |
| Build for testing | |
| Test without build | |
| Archive | |
| Clean | |
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
| Platform | Destination Specifier |
|---|---|
| macOS | |
| iOS Simulator | |
| iOS Device | |
| tvOS Simulator | |
| watchOS Simulator | |
| visionOS Simulator | |
| Generic (build only) | |
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
| Topic | File | When to Read |
|---|---|---|
| Project Discovery | project-discovery.md | Mixed projects, shared schemes |
| Swift Package Manager | swift-package-manager.md | Cross-compilation, Package.swift syntax |
| xcodebuild Basics | xcodebuild-basics.md | Build settings, SDK selection |
| Destinations | destinations.md | All platforms, multiple destinations |
| Testing | testing.md | Test filtering, parallel execution, coverage |
| Archiving | archiving.md | Archive creation |
| Troubleshooting | troubleshooting.md | Build/test failures, error recovery |
Common Pitfalls
- swift build with Xcode submodules: Only works for standalone packages. Use
with the package's scheme instead.xcodebuild - Missing destination for iOS: Use
for builds, or specify a simulator for tests.-destination 'generic/platform=iOS' - Unnecessary workspace flag: Only use
for CocoaPods or multi-project setups. Standard projects with SPM dependencies just use-workspace
..xcodeproj - Case-sensitive scheme names: Run
to see exact scheme names.xcodebuild -list - Outdated simulator names: Names change with Xcode versions. Run
.xcrun simctl list devices available - Code signing errors: Add
for builds that don't require signing.CODE_SIGNING_ALLOWED=NO