<!--
{
  "availability" : [
    "SwiftPM: 6.1.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "PackageDescription",
  "identifier" : "/documentation/PackageDescription/Package/Dependency/package(url:exact:traits:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "PackageDescription"
    ],
    "preciseIdentifier" : "s:18PackageDescription0A0C10DependencyC7package3url5exact6traitsAESS_AA7VersionVShyAE5TraitVGtFZ"
  },
  "title" : "package(url:exact:traits:)"
}
-->

# package(url:exact:traits:)

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

```
static func package(url: String, exact version: Version, traits: Set<Package.Dependency.Trait> = [.defaults]) -> Package.Dependency
```

## Parameters

`url`

The valid Git URL of the package.

`version`

The exact version of the dependency for this requirement.

`traits`

The trait configuration of this dependency. The default value enables the default traits of the package.

## 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`.

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

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)