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

# package(name:path:traits:)

Adds a local dependency to a named package located at the path and with an optional set of traits you provide.

```
static func package(name: String, path: String, traits: Set<Package.Dependency.Trait> = [.defaults]) -> Package.Dependency
```

## Parameters

`name`

The name of the Swift package.

`path`

The file system path to the package.

`traits`

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

## Return Value

A package dependency.

## Discussion

Swift Package Manager uses the package dependency as-is and doesn’t perform any source
control access. Local package dependencies are especially useful during
development of a new package or when working on multiple tightly coupled
packages.

---

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)