Subcommands27 subcommands
swift build
Build sources into binary products
swift run
Build and run an executable product
swift test
Build and run tests
swift package
Perform operations on Swift packages
swift package clean
Delete build artifacts
swift package purge-cache
Purge the global repository cache
swift package reset
Reset the complete cache/build directory
swift package update
Update package dependencies
swift package describe
Describe the current package
swift package init
Initialize a new package
swift package experimental-api-diff
Diagnose API-breaking changes to Swift modules in a package
swift package dump-symbol-graph
Dump Symbol Graph
swift package dump-pif
Dump PIF
swift package dump-package
Print parsed Package.swift as JSON
swift package edit
Put a package in editable mode
swift package unedit
Remove a package from editable mode
swift package config
Manipulate configuration of the package
swift package config set-mirror
Set a mirror for a dependency
swift package config unset-mirror
Remove an existing mirror
swift package config get-mirror
Print mirror configuration for the given package dependency
swift package resolve
Resolve package dependencies
swift package show-dependencies
Print the resolved dependency graph
swift package tools-version
Manipulate tools version of the current package
swift package generate-xcodeproj
Generates an Xcode project (this command will be deprecated soon)
swift package compute-checksum
Compute the checksum for a binary artifact
swift package archive-source
Create a source archive for the package
swift package completion-tool
Completion tool (for shell completions)
OptionsOn swift itself
--help-h-help
Show help information
--version
Show the version
-access-notes-path
Specify YAML file to override attributes on Swift declarations in this module <path>
-assert-config
Specify the assert_configuration replacement <configuration>
-async-main
Resolve main function as if it were called from an asynchronous context
-clang-target
Separately set the target we should use for internal Clang instance <target>
-color-diagnostics
Print diagnostics in color
-continue-building-after-errors
Continue building, even after errors are encountered
-coverage-prefix-map
Remap source paths in coverage info <prefix>
-debug-info-format
Specify the debug info format type <type>
-debug-info-store-invocation
Emit the compiler invocation in the debug info
-debug-prefix-map
Remap source paths in debug info <prefix=replacement>
-diagnostic-style
The formatting style used when printing diagnostics <style>
-disable-actor-data-race-checks
Disable runtime checks for actor data races
-disable-autolinking-runtime-compatibility-concurrency
Do not use autolinking for the concurrency runtime compatibility library
-disable-autolinking-runtime-compatibility-dynamic-replacements
Do not use autolinking for the dynamic replacement runtime compatibility library
-disable-autolinking-runtime-compatibility
Do not use autolinking for runtime compatibility libraries
-disable-clang-target
Disable a separately specified target triple for Clang instance to use
-disable-incremental-imports
Disable cross-module incremental build metadata and driver scheduling for Swift modules
-disable-only-one-dependency-file
Disables incremental build optimization that only produces one dependencies file
-disallow-use-new-driver
Disable using new swift-driver
-D
Marks a conditional compilation flag as true <flag>
-embed-tbd-for-module
Embed symbols from the module in the emitted tbd file <module>
-enable-actor-data-race-checks
Emit runtime checks for actor data races
-enable-bare-slash-regex
Enable the use of forward slash regular-expression literal syntax
-enable-experimental-additive-arithmetic-derivation
Enable experimental 'AdditiveArithmetic' derived conformances
-enable-experimental-concise-pound-file
Enable experimental concise '#file' identifier
-enable-experimental-cxx-interop
Allow importing C++ modules into Swift (experimental feature)
-enable-experimental-forward-mode-differentiation
Enable experimental forward mode differentiation
-enable-incremental-imports
Enable cross-module incremental build metadata and driver scheduling for Swift modules
-enable-library-evolution
Build the module to allow binary-compatible library evolution
-enable-only-one-dependency-file
Enables incremental build optimization that only produces one dependencies file
-enforce-exclusivity
Enforce law of exclusivity <enforcement>
-experimental-cxx-stdlib
C++ standard library to use; forwarded to Clang's -std lib flag <stdlib>
-file-compilation-dir
The compilation directory to embed in the debug info. Coverage mapping is not supported yet <path>
-file-prefix-map
Remap source paths in debug, coverage, and index info <prefix>
-framework
Specifies a framework which should be linked against <framework>
-Fsystem
Add directory to system framework search path <directory>
-F
Add directory to framework search path <directory>
-gdwarf-types
Emit full DWARF type info
-gline-tables-only
Emit minimal debug info for backtraces only
-gnone
Don't emit debug info
-g
Emit debug info. This is the preferred setting for debugging with LLDB
-index-ignore-clang-modules
Avoid indexing clang modules (pcms)
-index-store-path
Store indexing data to path <path>
-index-unit-output-path
Use the specified path as the output path in the produced index data <path>
-I
Add directory to the import search path <directory>
-j
Number of commands to execute in parallel <value>
-libc
The libc runtime library to use <runtime>
-locale
Choose a language for diagnostic messages <code>
-localization-path
Path to localized diagnostic messages directory <path>
-L
Add directory to library link search path <directory>
-l
Specifies a library which should be linked against <path>
-module-abi-name
ABI name to use for the contents of this module <name>
-module-alias
If a source file imports or references module <alias_name>, the <underlying_name> is used for the contents of the file <alias>
-module-cache-path
Specifies the Clang module cache path <path>
-module-link-name
Library to link against when using this module <name>
-module-name
Name of the module to build <name>
-no-color-diagnostics
Do not print diagnostics in color
-no-warnings-as-errors
Don't treat warnings as error
-nostdimport
Don't search the standard library import path for modules
-num-threads
Enable multi-threading and specify number of threads <value>
-Onone
Compile without any optimization
-Osize
Compile with optimizations and target small code size
-Ounchecked
Compile with optimizations and remove runtime safety checks
-O
Compile with optimizations
-prefix-serialized-debugging-options
Apply debug prefix mappings to serialized debug info in Swiftmodule files
-pretty-print
Pretty-print the output JSON
-print-educational-notes
Include educational notes in printed diagnostic output, if available
-print-target-info
Print target information for the given target <triple>, such as x86_64-apple-macos10.9
-Rcross-import
Emit a remark if a cross-import of a module is triggered
-remove-runtime-asserts
Remove runtime safety checks
-requirement-machine-abstract-signatures
Control usage of experimental generic signature minimization <value>
-requirement-machine-inferred-signatures
Control usage of experimental generic signature minimization <value>
-requirement-machine-protocol-signatures
Control usage of experimental protocol requirement signature minimization <value>
-Rmodule-loading
Emit a remark and file path of each loaded module
-Rpass-missed
Report missed transformations by optimization passes whose name matches the given POSIX regular expression <regex>
-Rpass
Report performed transformations by optimization passes whose name matches the given POSIX regular expression <regex>
-runtime-compatibility-version
Link compatibility library for Swift runtime version, or 'none' <version>
-save-optimization-record-passes
Only include passes which match a specified regular expression in the generated optimization record (by default, include all passes) <regex>
-save-optimization-record-path
Specify the file name of any generated optimization record <filename>
-save-optimization-record
Generate an optimization record file in a specific format <format>
-save-optimization-record
Generate a YAML optimization record file
-sdk
Compile against a specific SDK <sdk>
-serialize-diagnostics-path
Emit a serialized diagnostics file <path>
-static-executable
Statically link the executable
-static-stdlib
Statically link the Swift standard library
-strict-concurrency
Specify the how strict concurrency checking will be <concurrency>
-suppress-warnings
Suppress all warnings
-swift-isa-ptrauth-mode
Mode for staging isa/super signing <mode>
-swift-ptrauth-mode
Mode for staging pointer authentication <mode>
-swift-version
Interpret input according to a specific Swift language version number <version>
-target-cpu
Generate code for a particular CPU variant <cpu>
-target-min-inlining-version
Require inlinable code with no '@available' attribute to back-deploy to this version of the '-target' OS <version>
-target-variant
Generate 'zippered' code for macCatalyst that can run on the specified variant target triple in addition to the main -target triple <variant>
-target
Generate code for the given target <triple>, such as x86_64-apple-macos10.9 <triple>
-use-ld
Specifies the linker to be used <linker>
-user-module-version
Module version specified from Swift module authors <module>
-vfsoverlay
Add directory to VFS overlay file <directory>
-v
Show commands to run and use verbose output
-warn-concurrency
Warn about code that is unsafe according to the Swift Concurrency model and will become ill-formed in a future language version
-warn-implicit-overrides
Warn about implicit overrides of protocol members
-warn-swift3-objc-inference-complete
Warn about deprecated @objc inference in Swift 3 for every declaration that will no longer be inferred as @objc in Swift 4
-warn-swift3-objc-inference-minimal
Warn about deprecated @objc inference in Swift 3 based on direct uses of the Objective-C entrypoint
-warnings-as-errors
Treat warnings as errors
-working-directory
Resolve file paths relative to the specified directory <directory>
-Xcc
Pass <arg> to the C/C++/Objective-C compiler <arg>
-Xlinker
Specifies an option which should be passed to the linker <arg>