---
title: "compactMap(_:)"
framework: swift-package-manager
role: symbol
role_heading: Instance Method
path: "swift-package-manager/documentation/packageplugin/pathlist/compactmap(_:)"
---

# compactMap(_:)

Inherited from Sequence.compactMap(_:).

## Declaration

```swift
func compactMap<ElementOfResult>(_ transform: (Self.Element) throws -> ElementOfResult?) rethrows -> [ElementOfResult]
```
