---
title: "targets(named:)"
framework: swift-package-manager
role: symbol
role_heading: Instance Method
path: "swift-package-manager/documentation/packageplugin/package/targets(named:)"
---

# targets(named:)

The list of targets matching the given names.

## Declaration

```swift
func targets(named targetNames: [String]) throws -> [any Target]
```

## Discussion

Discussion Throws an error if any of the targets cannot be found.

## See Also

### Inspecting Package Targets

- [targets](swift-package-manager/documentation/packageplugin/package/targets.md)
- [targets(ofType:)](swift-package-manager/documentation/packageplugin/package/targets(oftype:).md)
