Combine is a declarative, reactive framework for processing values over time. You model asynchronous events as a Publisher that emits values to a Subscriber, then transform and compose those streams with operators in the Publishers namespace, scheduling work through types conforming to Scheduler. The framework provides concrete sources such as Just, Future, Deferred, Empty, and Fail, along with subjects like PassthroughSubject and CurrentValueSubject that you publish into imperatively, and ObservableObject with its ObservableObjectPublisher for emitting change notifications. Subscriptions are managed with Cancellable and AnyCancellable, so you can tear down a stream and stop receiving values when it is no longer needed.
Essentials 3
The core protocols that connect a source of values to a consumer over time.
- PrPublisheriOS 13.0+Declares that a type can transmit a sequence of values over time.
- PrSubscriberiOS 13.0+A protocol that declares a type that can receive input from a publisher.
- PrSubscriptioniOS 13.0+A protocol representing the connection of a subscriber to a publisher.
Operators 3
The namespaces that hold the operators used to transform, combine, and schedule streams.
- EnPublishersiOS 13.0+A namespace for types that serve as publishers.
- EnSubscribersiOS 13.0+A namespace for types that serve as subscribers.
- EnSubscriptionsiOS 13.0+A namespace for symbols related to subscriptions.
Publishing Values Imperatively 3
Subjects you publish into by hand to bridge imperative code with reactive streams.
- PrSubjectiOS 13.0+A publisher that exposes a method for outside callers to publish elements.
- ClPassthroughSubjectiOS 13.0+A subject that broadcasts elements to downstream subscribers.
- ClCurrentValueSubjectiOS 13.0+A subject that wraps a single value and publishes a new element whenever the value changes.
Concrete Publishers 6
Ready-made publishers that emit fixed, deferred, or recorded sequences of values.
- StJustiOS 13.0+A publisher that emits an output to each subscriber just once, and then finishes.
- ClFutureiOS 13.0+A publisher that eventually produces a single value and then finishes or fails.
- StDeferrediOS 13.0+A publisher that awaits subscription before running the supplied closure to create a publisher for the new subscriber.
- StEmptyiOS 13.0+A publisher that never publishes any values, and optionally finishes immediately.
- StFailiOS 13.0+A publisher that immediately terminates with the specified error.
- StRecordiOS 13.0+A publisher that allows for recording a series of inputs and a completion, for later playback to each subscriber.
Connectable and Async Publishers 3
Publishers that defer connection or expose values through Swift concurrency.
- PrConnectablePublisheriOS 13.0+A publisher that provides an explicit means of connecting and canceling publication.
- StAsyncPublisheriOS 15.0+A publisher that exposes its elements as an asynchronous sequence.
- StAsyncThrowingPublisheriOS 15.0+A publisher that exposes its elements as a throwing asynchronous sequence.
Observing Object Changes 2
Types that publish change notifications from an observable object.
- PrObservableObjectiOS 13.0+A type of object with a publisher that emits before the object has changed.
- ClObservableObjectPublisheriOS 13.0+A publisher that publishes changes from observable objects.
Managing Subscriptions 2
Types used to cancel a stream and stop receiving values when it is no longer needed.
- PrCancellableiOS 13.0+A protocol indicating that an activity or action supports cancellation.
- ClAnyCancellableiOS 13.0+A type-erasing cancellable object that executes a provided closure when canceled.
Scheduling Work 3
Protocols and schedulers that control when and where a publisher delivers values.
- PrScheduleriOS 13.0+A protocol that defines when and how to execute a closure.
- PrSchedulerTimeIntervalConvertibleiOS 13.0+A protocol that provides a scheduler with an expression for relative time.
- StImmediateScheduleriOS 13.0+A scheduler for performing synchronous actions.
Encoding and Decoding 2
Protocols that abstract the top-level coders used by encoding and decoding operators.
- PrTopLevelEncoderiOS 13.0+A type that defines methods for encoding.
- PrTopLevelDecoderiOS 13.0+A type that defines methods for decoding.
Identifying Streams 2
Types that give subscribers and subscriptions a unique identity.
- StCombineIdentifieriOS 13.0+A unique identifier for identifying publisher streams.
- PrCustomCombineIdentifierConvertibleiOS 13.0+A protocol for uniquely identifying publisher streams.
Structures 3
- StAnyPublisheriOS 13.0+A publisher that performs type erasure by wrapping another publisher.
- StAnySubscriberiOS 13.0+A type-erasing subscriber.
- StPublishediOS 13.0+A type that publishes a property marked with an attribute.