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

# receive(subscriber:)

Implements the Publisher protocol by accepting the subscriber and immediately publishing the optional’s value if it has one, or finishing normally if it doesn’t.

## Declaration

```swift
func receive<S>(subscriber: S) where Wrapped == S.Input, S : Subscriber, S.Failure == Never
```

## Parameters

- `subscriber`: The subscriber to add.
