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

# subscribe(on:options:)

Specifies the scheduler on which to perform subscribe, cancel, and request operations.

```
func subscribe<S>(on scheduler: S, options: S.SchedulerOptions? = nil) -> Publishers.SubscribeOn<Self, S> where S : Scheduler
```

## Parameters

`scheduler`

The scheduler used to send messages to upstream publishers.

`options`

Options that customize the delivery of elements.

## Return Value

A publisher which performs upstream operations on the specified scheduler.

## Discussion

In contrast with [`receive(on:options:)`](/documentation/Combine/Publisher/receive(on:options:)), which affects downstream messages, [`subscribe(on:options:)`](/documentation/Combine/Publisher/subscribe(on:options:)) changes the execution context of upstream messages.

In the following example, the [`subscribe(on:options:)`](/documentation/Combine/Publisher/subscribe(on:options:)) operator causes `ioPerformingPublisher` to receive requests on `backgroundQueue`, while the [`receive(on:options:)`](/documentation/Combine/Publisher/receive(on:options:)) causes `uiUpdatingSubscriber` to receive elements and completion on `RunLoop.main`.

```
let ioPerformingPublisher == // Some publisher.
let uiUpdatingSubscriber == // Some subscriber that updates the UI.

ioPerformingPublisher
    .subscribe(on: backgroundQueue)
    .receive(on: RunLoop.main)
    .subscribe(uiUpdatingSubscriber)
```

Using [`subscribe(on:options:)`](/documentation/Combine/Publisher/subscribe(on:options:)) also causes the upstream publisher to perform [`cancel()`](/documentation/Combine/Cancellable/cancel()) using the specfied scheduler.

---

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)