Scheme
A custom scheme for a project that defines how to build, run, test, profile, analyze, and archive.Overview
AScheme defines a collection of targets to build, run, test, profile, analyze, and archive. Schemes control the behavior of these actions in Xcode and from the command line.
Usage
Minimal Example
Initializer
.scheme() Static Method
String
required
The name of the scheme.
Marks the scheme as shared (i.e., checked into the repository and visible to
xcodebuild from the command line).When
true, the scheme doesn’t show up in Xcode’s scheme dropdown list.BuildAction?
default:"nil"
Action that builds the project targets.
TestAction?
default:"nil"
Action that runs the project tests.
RunAction?
default:"nil"
Action that runs project built products.
ArchiveAction?
default:"nil"
Action that runs the project archive.
ProfileAction?
default:"nil"
Action that profiles the project.
AnalyzeAction?
default:"nil"
Action that analyzes the project.
Action Types
BuildAction
Defines which targets to build and in what order.TestAction
Defines which test targets to run and testing options.RunAction
Defines how to run the app, including which executable to run and runtime options.ArchiveAction
Defines how to archive the app for distribution.ProfileAction
Defines how to profile the app using Instruments.AnalyzeAction
Defines how to run static analysis.Best Practices
-
Shared Schemes: Set
shared: truefor schemes you want to commit to version control and use in CI/CD. -
Configuration-Specific Schemes: Create separate schemes for different configurations:
-
Test Coverage: Enable code coverage in test actions:
-
Hidden Schemes: Use
hidden: truefor internal or experimental schemes you don’t want to clutter the UI.