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

# prefix(_:)

## Declaration

```swift
func prefix(_ maxLength: Int) -> Optional<Wrapped>.Publisher
```
