<!--
{
  "availability" : [
    "SwiftPM: -"
  ],
  "documentType" : "symbol",
  "framework" : "PackageDescription",
  "identifier" : "/documentation/PackageDescription/Package/Dependency/Requirement-swift.enum/branch(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "PackageDescription"
    ],
    "preciseIdentifier" : "s:18PackageDescription0A0C10DependencyC11RequirementO6branchyAGSSFZ"
  },
  "title" : "branch(_:)"
}
-->

# branch(_:)

Returns a requirement for a source control branch.

```
static func branch(_ name: String) -> Package.Dependency.Requirement
```

## Parameters

`name`

The name of the branch.

## Discussion

Note that packages that use branch-based dependency requirements can’t
be depended upon by packages that use version-based dependency
requirements; you should remove branch-based dependency requirements
before publishing a version of your package.

The following example defines a version requirement that accepts any
change in the develop branch.

```swift
.branch(“develop”)
```

---

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)