---
title: "subscribe(_:)"
framework: combine
role: symbol
role_heading: Instance Method
path: "combine/publisher/subscribe(_:)-3fk20"
---

# subscribe(_:)

Attaches the specified subject to this publisher.

## Declaration

```swift
func subscribe<S>(_ subject: S) -> AnyCancellable where S : Subject, Self.Failure == S.Failure, Self.Output == S.Output
```

## Parameters

- `subject`: The subject to attach to this publisher.

## Mentioned in

Controlling Publishing with Connectable Publishers

## See Also

### Working with subscribers

- [receive(subscriber:)](combine/publisher/receive(subscriber:).md)
- [subscribe(_:)](combine/publisher/subscribe(_:)-4u8kn.md)
