<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Combine",
  "identifier" : "/documentation/Combine/Publisher/subscribe(_:)-4u8kn",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Combine"
    ],
    "preciseIdentifier" : "s:7Combine9PublisherPAAE9subscribeyyqd__AA10SubscriberRd__7FailureQyd__AFRtz5InputQyd__6OutputRtzlF"
  },
  "title" : "subscribe(_:)"
}
-->

# subscribe(_:)

Attaches the specified subscriber to this publisher.

```
func subscribe<S>(_ subscriber: S) where S : Subscriber, Self.Failure == S.Failure, Self.Output == S.Input
```

## Parameters

`subscriber`

The subscriber to attach to this publisher. After attaching, the subscriber can start to receive values.

## Discussion

Always call this function instead of [`receive(subscriber:)`](/documentation/Combine/Publisher/receive(subscriber:)).
Adopters of [`Publisher`](/documentation/Combine/Publisher) must implement [`receive(subscriber:)`](/documentation/Combine/Publisher/receive(subscriber:)). The implementation of [`subscribe(_:)`](/documentation/Combine/Publisher/subscribe(_:)-4u8kn) provided by [`Publisher`](/documentation/Combine/Publisher) calls through to [`receive(subscriber:)`](/documentation/Combine/Publisher/receive(subscriber:)).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)