Dependency
A package dependency of a Swift package.
PackageDependency.swift:27Dependency.mdclass Dependency
A package dependency consists of a Git URL to the source of the package, and a requirement for the version of the package.
Swift Package Manager performs a process called dependency resolution to determine the exact version of the package dependencies that an app or other Swift package can use. The Package.resolved
file records the results of the dependency resolution and lives in the top-level directory of a Swift package. If you add the Swift package as a package dependency to an app for an Apple platform, you can find the Package.resolved
file inside your .xcodeproj
or .xcworkspace
.
Creating a Package Dependency
static func package(name: String, path: String
) -> Package.Dependency Adds a dependency to a package located at the given path on the filesystem.
static func package(url: String, from: Version
) -> Package.Dependency Adds a package dependency that uses the version requirement, starting with the given minimum version, going up to the next major version.
static func package(url: String, Range<Version>
) -> Package.Dependency Adds a package dependency starting with a specific minimum version, up to but not including a specified maximum version.
static func package(url: String, ClosedRange<Version>
) -> Package.Dependency Adds a package dependency starting with a specific minimum version, going up to and including a specific maximum version.
static func package(url: String, branch: String
) -> Package.Dependency Adds a remote package dependency given a branch requirement.
static func package(url: String, revision: String
) -> Package.Dependency Adds a remote package dependency given a revision requirement.
static func package(url: String, exact: Version
) -> Package.Dependency Adds a package dependency that uses the exact version requirement.
static func package(path: String
) -> Package.Dependency Adds a dependency to a package located at the given path.
Declaring Requirements
var requirement: Package.Dependency.Requirement
The dependency requirement of the package dependency.
enum Requirement
An enum that represents the requirement for a package dependency.
Describing a Package Dependency
let kind: Package.Dependency.Kind
A description of the package dependency.
struct Version
A version according to the semantic versioning specification.
See also
var dependencies: [Package.Dependency]
The list of package dependencies.
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (14) members.
Type members
init(name: String, defaultLocalization: LanguageTag?, platforms: [SupportedPlatform]?, pkgConfig: String?, providers: [SystemPackageProvider]?, products: [Product], dependencies: [Package.Dependency], targets: [Target], swiftLanguageVersions: [SwiftVersion]?, cLanguageStandard: CLanguageStandard?, cxxLanguageStandard: CXXLanguageStandard?
) Initializes a Swift package with configuration options you provide.
Show obsolete interfaces (3)
Hide obsolete interfaces
init(name: String, pkgConfig: String?, providers: [SystemPackageProvider]?, products: [Product], dependencies: [Package.Dependency], targets: [Target], swiftLanguageVersions: [SwiftVersion]?, cLanguageStandard: CLanguageStandard?, cxxLanguageStandard: CXXLanguageStandard?
) Initializes a Swift package with configuration options you provide.
init(name: String, pkgConfig: String?, providers: [SystemPackageProvider]?, products: [Product], dependencies: [Package.Dependency], targets: [Target], swiftLanguageVersions: [Int]?, cLanguageStandard: CLanguageStandard?, cxxLanguageStandard: CXXLanguageStandard?
) Initializes a Swift package with configuration options you provide.
init(name: String, platforms: [SupportedPlatform]?, pkgConfig: String?, providers: [SystemPackageProvider]?, products: [Product], dependencies: [Package.Dependency], targets: [Target], swiftLanguageVersions: [SwiftVersion]?, cLanguageStandard: CLanguageStandard?, cxxLanguageStandard: CXXLanguageStandard?
) Initializes a Swift package with configuration options you provide.
Instance members
var cLanguageStandard: CLanguageStandard?
The C language standard to use for all C targets in this package.
var cxxLanguageStandard: CXXLanguageStandard?
The C++ language standard to use for all C++ targets in this package.
var defaultLocalization: LanguageTag?
The default localization for resources.
var name: String
The name of the Swift package.
var pkgConfig: String?
The name to use for C modules.
var platforms: [SupportedPlatform]?
The list of minimum versions for platforms supported by the package.
var products: [Product]
The list of products that this package vends and that clients can use.
var providers: [SystemPackageProvider]?
An array of providers for a system target.
var swiftLanguageVersions: [SwiftVersion]?
The list of Swift versions with which this package is compatible.
var targets: [Target]
The list of targets that are part of this package.
Citizens in PackageDescription
Types
enum Kind
The type of dependency.
enum RegistryRequirement
An enum that represents the requirement for a package dependency.
enum SourceControlRequirement
An enum that represents the requirement for a package dependency.
Type members
static func package(id: String, ClosedRange<Version>
) -> Package.Dependency Adds a package dependency starting with a specific minimum version, going up to and including a specific maximum version.
static func package(id: String, Range<Version>
) -> Package.Dependency Adds a package dependency starting with a specific minimum version, up to but not including a specified maximum version.
static func package(id: String, exact: Version
) -> Package.Dependency Adds a package dependency that uses the exact version requirement.
static func package(id: String, from: Version
) -> Package.Dependency Adds a package dependency that uses the version requirement, starting with the given minimum version, going up to the next major version.
Show obsolete interfaces (7)
Hide obsolete interfaces
static func package(name: String?, url: String, Package.Dependency.Requirement
) -> Package.Dependency Adds a remote package dependency with a given version requirement.
static func package(name: String, url: String, ClosedRange<Version>
) -> Package.Dependency Adds a package dependency starting with a specific minimum version, going up to and including a specific maximum version.
static func package(name: String, url: String, Range<Version>
) -> Package.Dependency Adds a package dependency starting with a specific minimum version, up to but not including a specified maximum version.
static func package(name: String, url: String, branch: String
) -> Package.Dependency Adds a remote package dependency given a branch requirement.
static func package(name: String, url: String, from: Version
) -> Package.Dependency Adds a package dependency that uses the version requirement, starting with the given minimum version, going up to the next major version.
static func package(name: String, url: String, revision: String
) -> Package.Dependency Adds a remote package dependency given a revision requirement.
static func package(url: String, Package.Dependency.Requirement
) -> Package.Dependency Adds a remote package dependency given a version requirement.
Instance members
Show obsolete interfaces (2)
Hide obsolete interfaces
var name: String?
The name of the dependency.
var url: String?
The Git URL of the package dependency.