The configuration of a Swift package.
SDK
- Xcode 10.2+
Framework
- Swift Package Manager
Declaration
Overview
Pass configuration options as parameters to your package’s initializer statement to provide the name of the package, its targets, products, dependencies, and other configuration options.
By convention, the properties of a Package
are defined in a single nested initializer statement, and not modified after initialization. The following package manifest shows the initialization of a simple package object for the MyLibrary Swift package:
A Package
manifest file must begin with the string // swift-tools-version:
followed by a version number specifier. The following code listing shows a few examples of valid declarations of the Swift tools version:
The Swift tools version declares the version of the Package
library, the minimum version of the Swift tools and Swift language compatibility version to process the manifest, and the minimum version of the Swift tools that are needed to use the Swift package. Each version of Swift can introduce updates to the Package
framework, but the previous API version will continue to be available to packages which declare a prior tools version. This behavior lets you take advantage of new releases of Swift, the Swift tools, and the Package
library, without having to update your package’s manifest or losing access to existing packages.