<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "PackageDescription",
  "identifier" : "/documentation/PackageDescription/Package/Dependency/package(url:_:)-2ys47",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "PackageDescription"
    ],
    "preciseIdentifier" : "s:18PackageDescription0A0C10DependencyC7package3url_AESS_SnyAA7VersionVGtFZ"
  },
  "title" : "package(url:_:)"
}
-->

# package(url:_:)

Adds a remote package dependency starting with a specific minimum version, up to
but not including a specified maximum version.

```
static func package(url: String, _ range: Range<Version>) -> Package.Dependency
```

## Parameters

`url`

The valid Git URL of the package.

`range`

The custom version range requirement.

## Return Value

A `Package.Dependency` instance.

## Discussion

The following example allows the Swift Package Manager to pick
versions `1.2.3`, `1.2.4`, `1.2.5`, but not `1.2.6`.

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

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)