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

# count()

## Declaration

```swift
func count() -> Optional<Int>.Publisher
```
