Dependency
A package dependency of a Swift package.
class 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: 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: Kind
A description of the package dependency.
struct Version
A version according to the semantic versioning specification.