ReactiveX /RxSwift

Reactive Programming in Swift

★ 24,626⑂ 4,147
SwiftCreated 2015-04-07
24,626
stars
+-2+-6+-6
4,147
forks
–
watchers
–
prs
–
issues
–
releases
–
discussions

README

Rx is a generic abstraction of computation expressed through Observable interface, which lets you broadcast and subscribe to values and other events from an Observable stream.

RxSwift is the Swift-specific implementation of the Reactive Extensions standard.



While this version aims to stay true to the original spirit and naming conventions of Rx, this project also aims to provide a true Swift-first API for Rx APIs.

Cross platform documentation can be found on ReactiveX.io.

Like other Rx implementations, RxSwift's intention is to enable easy composition of asynchronous operations and streams of data in the form of Observable objects and a suite of methods to transform and compose these pieces of asynchronous work.

KVO observation, async operations, UI Events and other streams of data are all unified under abstraction of sequence. This is the reason why Rx is so simple, elegant and powerful.

 I came here because I want to ...

 ... understand

 why use rx?
 the basics, getting started with RxSwift
 traits - what are Single, Completable, Maybe, Driver, and ControlProperty ... and why do they exist?
 testing
 tips and common errors
 debugging
 the math behind Rx
 what are hot and cold observable sequences?

 ... install

 Integrate RxSwift/RxCocoa with my app. Installation Guide

 ... hack around

 with the example app. Running Example App
 with operators in playgrounds. Playgrounds

 ... interact

 All of this is great, but it would be nice to talk with other people using RxSwift and exchange experiences. Join Slack Channel
 Report a problem using the library. Open an Issue With Bug Template
 Request a new feature. Open an Issue With Feature Request Template
 Help out Check out contribution guide

 ... compare

 with Combine and ReactiveSwift.

 ... understand the structure

RxSwift is as compositional as the asynchronous work it drives. The core unit is RxSwift itself, while other dependencies can be added for UI Work, testing, and more.

It comprises five separate components depending on each other in the following way:

none
┌──────────────┐    ┌──────────────┐
│   RxCocoa    ├────▶   RxRelay    │
└───────┬──────┘    └──────┬───────┘
        │                  │
┌───────▼──────────────────▼───────┐
│             RxSwift              │
└───────▲──────────────────▲───────┘
        │                  │
┌───────┴──────┐    ┌──────┴───────┐
│    RxTest    │    │  RxBlocking  │
└──────────────┘    └──────────────┘


 RxSwift: The core of RxSwift, providing the Rx standard as (mostly) defined by ReactiveX. It has no other dependencies.
 RxCocoa: Provides Cocoa-specific capabilities for general iOS/macOS/watchOS & tvOS app development, such as Shared Sequences, Traits, and much more. It depends on both RxSwift and RxRelay.
 RxRelay: Provides PublishRelay, BehaviorRelay and ReplayRelay, three simple wrappers around Subjects. It depends on RxSwift.
 RxTest and RxBlocking: Provides testing capabilities for Rx-based systems. It depends on RxSwift.

 U

Snapshot: 2026-11-10T09:35:25Z · Data license Apache-2.0 · JSON