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

# package(id:exact:)

Adds a remote package dependency with an exact version requirement.

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

## Parameters

`id`

The identity 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 multiple other packages depend on a package.
Because 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(id: "scope.name", exact: "1.2.3"),
```

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

---

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)