<!--
{
  "availability" : [
    "SwiftPM: 5.5.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "PackageDescription",
  "identifier" : "/documentation/PackageDescription/Product/plugin(name:targets:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "PackageDescription"
    ],
    "preciseIdentifier" : "s:18PackageDescription7ProductC6plugin4name7targetsACSS_SaySSGtFZ"
  },
  "title" : "plugin(name:targets:)"
}
-->

# plugin(name:targets:)

Defines a product that vends a package plugin target for use by clients of the package.

```
static func plugin(name: String, targets: [String]) -> Product
```

## Parameters

`name`

The name of the plugin product.

`targets`

The plugin targets to vend as a product.

## Return Value

A `Product` instance.

## Discussion

It is not necessary to define a product for a plugin that
is only used within the same package where you define it. All the targets
listed must be plugin targets in the same package as the product. Swift Package Manager
will apply them to any client targets of the product in the order
they are listed.

---

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)