---
title: "plugin(name:targets:)"
framework: swift-package-manager
role: symbol
role_heading: Type Method
path: "swift-package-manager/documentation/packagedescription/product/plugin(name:targets:)"
---

# plugin(name:targets:)

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

## Declaration

```swift
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

Return Value A Product instance.

## Discussion

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.

## See Also

### Creating a Plugin Product

- [Product.Plugin](swift-package-manager/documentation/packagedescription/product/plugin.md)
