Contents

package(url:exact:)

Adds a remote package dependency that uses an exact version requirement.

Declaration

static func package(url: String, exact version: Version) -> Package.Dependency

Parameters

  • url:

    The valid Git URL of the package.

  • version:

    The exact version of the dependency for this requirement.

Return Value

A Package.Dependency instance.

Discussion

Specifying exact version requirements are not recommended as they can cause conflicts in your dependency graph when other packages depend on this package. As Swift packages follow the semantic versioning convention, think about specifying a version range instead.

The following example instructs the Swift Package Manager to use version 1.2.3.

.package(url: "https://example.com/example-package.git", exact: "1.2.3"),

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 URL