<!--
{
  "availability" : [
    "iOS: 13.0 -",
    "iPadOS: 13.0 -",
    "macCatalyst: 13.0 -",
    "macOS: 10.15 -",
    "tvOS: 13.0 -",
    "visionOS: 1.0 -",
    "watchOS: 6.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Combine",
  "identifier" : "/documentation/Combine",
  "metadataVersion" : "0.1.0",
  "role" : "Framework",
  "symbol" : {
    "kind" : "Framework",
    "modules" : [
      "Combine"
    ],
    "preciseIdentifier" : "Combine"
  },
  "title" : "Combine"
}
-->

# Combine

Customize handling of asynchronous events by combining event-processing operators.

## Overview

The Combine framework provides a declarative Swift API for processing values over
time. These values can represent many kinds of asynchronous events. Combine declares
*publishers* to expose values that can change over time, and *subscribers* to receive
those values from the publishers.

- The ``doc://com.apple.Combine/documentation/Combine/Publisher`` protocol declares a type that can deliver
  a sequence of values over time. Publishers have *operators* to act on the values
  received from upstream publishers and republish them.
- At the end of a chain of publishers, a ``doc://com.apple.Combine/documentation/Combine/Subscriber`` acts
  on elements as it receives them. Publishers only emit values when explicitly requested
  to do so by subscribers. This puts your subscriber code in control of how fast it
  receives events from the publishers it’s connected to.

Several Foundation types expose their functionality through publishers, including
<doc://com.apple.documentation/documentation/Foundation/Timer>, <doc://com.apple.documentation/documentation/Foundation/NotificationCenter>,
and <doc://com.apple.documentation/documentation/Foundation/URLSession>. Combine also provides
a built-in publisher for any property that’s compliant with Key-Value Observing.

You can combine the output of multiple publishers and coordinate their interaction.
For example, you can subscribe to updates from a text field’s publisher, and use
the text to perform URL requests. You can then use another publisher to process the
responses and use them to update your app.

By adopting Combine, you’ll make your code easier to read and maintain, by centralizing
your event-processing code and eliminating troublesome techniques like nested closures
and convention-based callbacks.

## Topics

### Essentials

[Receiving and Handling Events with Combine](/documentation/Combine/receiving-and-handling-events-with-combine)

Customize and receive events from asynchronous sources.

### Publishers

[`Publisher`](/documentation/Combine/Publisher)

Declares that a type can transmit a sequence of values over time.

[`Publishers`](/documentation/Combine/Publishers)

A namespace for types that serve as publishers.

[`AnyPublisher`](/documentation/Combine/AnyPublisher)

A publisher that performs type erasure by wrapping another publisher.

[`Published`](/documentation/Combine/Published)

A type that publishes a property marked with an attribute.

[`Cancellable`](/documentation/Combine/Cancellable)

A protocol indicating that an activity or action supports cancellation.

[`AnyCancellable`](/documentation/Combine/AnyCancellable)

A type-erasing cancellable object that executes a provided closure when canceled.

### Convenience Publishers

[`Future`](/documentation/Combine/Future)

A publisher that eventually produces a single value and then finishes or fails.

[`Just`](/documentation/Combine/Just)

A publisher that emits an output to each subscriber just once, and then finishes.

[`Deferred`](/documentation/Combine/Deferred)

A publisher that awaits subscription before running the supplied closure to create a publisher for the new subscriber.

[`Empty`](/documentation/Combine/Empty)

A publisher that never publishes any values, and optionally finishes immediately.

[`Fail`](/documentation/Combine/Fail)

A publisher that immediately terminates with the specified error.

[`Record`](/documentation/Combine/Record)

A publisher that allows for recording a series of inputs and a completion, for later playback to each subscriber.

### Connectable Publishers

[Controlling Publishing with Connectable Publishers](/documentation/Combine/controlling-publishing-with-connectable-publishers)

Coordinate when publishers start sending elements to subscribers.

[`ConnectablePublisher`](/documentation/Combine/ConnectablePublisher)

A publisher that provides an explicit means of connecting and canceling publication.

### Subscribers

[Processing Published Elements with Subscribers](/documentation/Combine/processing-published-elements-with-subscribers)

Apply back pressure to precisely control when publishers produce elements.

[`Subscriber`](/documentation/Combine/Subscriber)

A protocol that declares a type that can receive input from a publisher.

[`Subscribers`](/documentation/Combine/Subscribers)

A namespace for types that serve as subscribers.

[`AnySubscriber`](/documentation/Combine/AnySubscriber)

A type-erasing subscriber.

[`Subscription`](/documentation/Combine/Subscription)

A protocol representing the connection of a subscriber to a publisher.

[`Subscriptions`](/documentation/Combine/Subscriptions)

A namespace for symbols related to subscriptions.

### Subjects

[`Subject`](/documentation/Combine/Subject)

A publisher that exposes a method for outside callers to publish elements.

[`CurrentValueSubject`](/documentation/Combine/CurrentValueSubject)

A subject that wraps a single value and publishes a new element whenever the value changes.

[`PassthroughSubject`](/documentation/Combine/PassthroughSubject)

A subject that broadcasts elements to downstream subscribers.

### Schedulers

[`Scheduler`](/documentation/Combine/Scheduler)

A protocol that defines when and how to execute a closure.

[`ImmediateScheduler`](/documentation/Combine/ImmediateScheduler)

A scheduler for performing synchronous actions.

[`SchedulerTimeIntervalConvertible`](/documentation/Combine/SchedulerTimeIntervalConvertible)

A protocol that provides a scheduler with an expression for relative time.

### Combine Migration

[Routing Notifications to Combine Subscribers](/documentation/Combine/routing-notifications-to-combine-subscribers)

Deliver notifications to subscribers by using notification centers’ publishers.

[Replacing Foundation Timers with Timer Publishers](/documentation/Combine/replacing-foundation-timers-with-timer-publishers)

Publish elements periodically by using a timer.

[Performing Key-Value Observing with Combine](/documentation/Combine/performing-key-value-observing-with-combine)

Expose KVO changes with a Combine publisher.

[Using Combine for Your App’s Asynchronous Code](/documentation/Combine/using-combine-for-your-app-s-asynchronous-code)

Apply common patterns to migrate your closure-based, event-handling code.

### Observable Objects

[`ObservableObject`](/documentation/Combine/ObservableObject)

A type of object with a publisher that emits before the object has changed.

[`ObservableObjectPublisher`](/documentation/Combine/ObservableObjectPublisher)

A publisher that publishes changes from observable objects.

### Asynchronous Publishers

[`AsyncPublisher`](/documentation/Combine/AsyncPublisher)

A publisher that exposes its elements as an asynchronous sequence.

[`AsyncThrowingPublisher`](/documentation/Combine/AsyncThrowingPublisher)

A publisher that exposes its elements as a throwing asynchronous sequence.

### Encoders and Decoders

[`TopLevelEncoder`](/documentation/Combine/TopLevelEncoder)

A type that defines methods for encoding.

[`TopLevelDecoder`](/documentation/Combine/TopLevelDecoder)

A type that defines methods for decoding.

### Debugging Identifiers

[`CustomCombineIdentifierConvertible`](/documentation/Combine/CustomCombineIdentifierConvertible)

A protocol for uniquely identifying publisher streams.

[`CombineIdentifier`](/documentation/Combine/CombineIdentifier)

A unique identifier for identifying publisher streams.



---

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)
