Contents

package(id:_:)

Adds a remote package dependency starting with a specific minimum version, up to but not including a specified maximum version.

Declaration

static func package(id: String, _ range: Range<Version>) -> Package.Dependency

Parameters

  • id:

    The identity of the package.

  • range:

    The custom version range requirement.

Return Value

A Package.Dependency instance.

Discussion

The following example allows the Swift Package Manager to pick versions 1.2.3, 1.2.4, 1.2.5, but not 1.2.6.

.package(id: "scope.name", "1.2.3"..<"1.2.6"),

The following example allows the Swift Package Manager to pick versions between 1.0.0 and 2.0.0

.package(id: "scope.name", .upToNextMajor(from: "1.0.0"),

The following example allows the Swift Package Manager to pick versions between 1.0.0 and 1.1.0

.package(id: "scope.name", .upToNextMinor(from: "1.0.0"),

If the package you depend on defines traits, the package manager uses the dependency with its default set of traits.

See Also

Creating a package dependency from a registry