<!--
{
  "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/makeConnectable()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Combine"
    ],
    "preciseIdentifier" : "s:7Combine9PublisherPAAs5NeverO7FailureRtzrlE15makeConnectableAA10PublishersO04MakeF0Vy_xGyF"
  },
  "title" : "makeConnectable()"
}
-->

# makeConnectable()

Creates a connectable wrapper around the publisher.

```
func makeConnectable() -> Publishers.MakeConnectable<Self>
```

## Return Value

A [`ConnectablePublisher`](/documentation/Combine/ConnectablePublisher) wrapping this publisher.

## Discussion

In the following example, [`makeConnectable()`](/documentation/Combine/Publisher/makeConnectable()) wraps its upstream publisher (an instance of [`Publishers.Share`](/documentation/Combine/Publishers/Share)) with a [`ConnectablePublisher`](/documentation/Combine/ConnectablePublisher). Without this, the first sink subscriber would receive all the elements from the sequence publisher and cause it to complete before the second subscriber attaches. By making the publisher connectable, the publisher doesn’t produce any elements until after the [`connect()`](/documentation/Combine/ConnectablePublisher/connect()) call.

```
 let subject = Just<String>("Sent")
 let pub = subject
     .share()
     .makeConnectable()
 cancellable1 = pub.sink { print ("Stream 1 received: \($0)")  }

 // For example purposes, use DispatchQueue to add a second subscriber
 // a second later, and then connect to the publisher a second after that.
 DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
     self.cancellable2 = pub.sink { print ("Stream 2 received: \($0)") }
 }
 DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
     self.connectable = pub.connect()
 }
 // Prints:
 // Stream 2 received: Sent
 // Stream 1 received: Sent
```

> Note: The ``doc://com.apple.Combine/documentation/Combine/ConnectablePublisher/connect()`` operator returns a ``doc://com.apple.Combine/documentation/Combine/Cancellable`` instance that you must retain. You can also use this instance to cancel publishing.

---

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)