---
title: collect()
framework: swift
role: symbol
role_heading: Instance Method
path: swift/optional/publisher-swift.struct/collect()
---

# collect()

## Declaration

```swift
func collect() -> Optional<[Optional<Wrapped>.Publisher.Output]>.Publisher
```
