<!--
{
  "availability" : [
    "SwiftPM: -"
  ],
  "documentType" : "symbol",
  "framework" : "PackageDescription",
  "identifier" : "/documentation/PackageDescription/TargetDependencyCondition/when(platforms:)-4djh6",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "PackageDescription"
    ],
    "preciseIdentifier" : "s:18PackageDescription25TargetDependencyConditionV4when9platformsACSayAA8PlatformVGSg_tFZ"
  },
  "title" : "when(platforms:)"
}
-->

# when(platforms:)

Creates a target dependency condition.

```
static func when(platforms: [Platform]? = nil) -> TargetDependencyCondition
```

## Parameters

`platforms`

The applicable platforms for this target dependency condition.

---

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)