<!--
{
  "availability" : [
    "SwiftPM: 5.2.0 - 5.6.0"
  ],
  "documentType" : "symbol",
  "framework" : "PackageDescription",
  "identifier" : "/documentation/PackageDescription/Package/Dependency/package(name:url:_:)-6k3na",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "PackageDescription"
    ],
    "preciseIdentifier" : "s:18PackageDescription0A0C10DependencyC7package4name3url_AESSSg_SSAE11RequirementOtFZ"
  },
  "title" : "package(name:url:_:)"
}
-->

# package(name:url:_:)

Adds a remote package dependency with a given version requirement.

```
static func package(name: String?, url: String, _ requirement: Package.Dependency.Requirement) -> Package.Dependency
```

## Parameters

`name`

The name of the Swift package or `nil` to deduce the name from the package’s Git URL.

`url`

The valid Git URL of the package.

`requirement`

A dependency requirement. See static methods on
[`Package.Dependency.Requirement`](/documentation/PackageDescription/Package/Dependency/Requirement-swift.enum) for available options.

## Return Value

A `Package.Dependency` instance.

---

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)