---
title: "when(traits:)"
framework: packagedescription
role: symbol
role_heading: Type Method
path: "packagedescription/package/dependency/trait/condition-swift.struct/when(traits:)"
---

# when(traits:)

Creates a package dependency trait condition.

## Declaration

```swift
static func when(traits: Set<String>) -> Package.Dependency.Trait.Condition?
```

## Parameters

- `traits`: The set of traits that enable the dependencies trait.

## Discussion

Discussion If the depending package enables any of the traits you provide, the package manager enables the dependency to which this condition applies.
