# reactivex/rxswift architecture

> Architecture diagram of the GitHub repository reactivex/rxswift, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/reactivex/rxswift
- Repository: https://github.com/reactivex/rxswift

## Overview

RxSwift is a Swift reactive-programming library: callers turn asynchronous work and events into observable sequences, compose them with operators and schedulers, then subscribe or bind results. RxCocoa adapts Cocoa/UI events and bindings; RxRelay supplies subject-backed relays; RxBlocking and RxTest provide testing-oriented consumption and virtual-time tools. The example app demonstrates geolocation and image-loading workflows, including reachability-aware retries and sectioned-data differencing. Most relationships below follow explicit README statements or shown source references; unsampled implementation details are not inferred.

Main entry points: [`RxSwift/Observable.swift`](https://github.com/reactivex/rxswift/blob/main/RxSwift/Observable.swift) (Observable Streams), [`RxCocoa/iOS`](https://github.com/reactivex/rxswift/tree/main/RxCocoa/iOS) (UI Wrappers), [`RxExample/RxDataSources/Differentiator/Diff.swift`](https://github.com/reactivex/rxswift/blob/main/RxExample/RxDataSources/Differentiator/Diff.swift) (Section Differencing), [`RxExample/RxExample/Services/ImageService.swift`](https://github.com/reactivex/rxswift/blob/main/RxExample/RxExample/Services/ImageService.swift) (Image Service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Reactive Core"]
  node_observable["Observable Streams<br/>[Observable.swift]"]
  node_operators["Stream Operators"]
  node_subjects["Subjects"]
  node_schedulers["Schedulers"]
  node_disposables["Disposal"]
  node_traits["Primitive Traits"]
end

subgraph group_cocoa["Cocoa Integration"]
  node_cocoa_wrappers["UI Wrappers"]
  node_delegate_proxy["Delegate Proxies"]
  node_shared["Shared Sequences"]
  node_urlsession["URLSession Adapter"]
end

subgraph group_aux["Supporting APIs"]
  node_relays["Relays"]
  node_blocking["Blocking API"]
  node_rxtest["Virtual-Time Testing"]
end

subgraph group_example["Example App"]
  node_geo_api["Location Adapter"]
  node_geo_proxy["Location Proxy"]
  node_geo_service["Geolocation Service"]
  node_image_service["Image Service<br/>[ImageService.swift]"]
  node_reach_service["Reachability Service"]
  node_reachability["Reachability Monitor<br/>[Reachability.swift]"]
  node_activity["Activity Indicator"]
  node_downloadable["Image Result"]
end

subgraph group_diff["Sectioned Data"]
  node_diff["Section Differencing<br/>[Diff.swift]"]
  node_section_model["Section Identity"]
  node_changeset["Changesets<br/>[Changeset.swift]"]
  node_item_path["Item Paths<br/>[ItemPath.swift]"]
  node_identity["Identity Types"]
end

node_caller(("Application"))

node_caller -->|"creates streams"| node_observable
node_observable -->|"composes with"| node_operators
node_caller -->|"observes UI"| node_cocoa_wrappers
node_cocoa_wrappers -->|"wraps delegates"| node_delegate_proxy
node_cocoa_wrappers -->|"binds sequences"| node_shared
node_cocoa_wrappers -->|"adapts requests"| node_urlsession
node_observable -->|"schedules work"| node_schedulers
node_observable -->|"manages subscriptions"| node_disposables
node_observable -->|"emits events"| node_subjects
node_observable -->|"specializes streams"| node_traits
node_relays -->|"depends on"| node_observable
node_cocoa_wrappers -->|"depends on"| node_relays
node_blocking -->|"depends on"| node_observable
node_rxtest -->|"depends on"| node_observable
node_geo_service -->|"observes locations"| node_geo_api
node_geo_api -->|"uses proxy"| node_geo_proxy
node_image_service -->|"retries by reachability"| node_reach_service
node_image_service -->|"tracks loading"| node_activity
node_image_service -->|"emits image result"| node_downloadable
node_reach_service -->|"starts monitor"| node_reachability
node_diff -->|"diffs sections"| node_section_model
node_diff -->|"tracks item paths"| node_item_path
node_diff -->|"indexes identities"| node_identity
node_diff -.->|"generates changesets"| node_changeset

click node_observable "https://github.com/reactivex/rxswift/blob/main/RxSwift/Observable.swift"
click node_operators "https://github.com/reactivex/rxswift/tree/main/RxSwift/Observables"
click node_subjects "https://github.com/reactivex/rxswift/tree/main/RxSwift/Subjects"
click node_schedulers "https://github.com/reactivex/rxswift/tree/main/RxSwift/Schedulers"
click node_disposables "https://github.com/reactivex/rxswift/tree/main/RxSwift/Disposables"
click node_traits "https://github.com/reactivex/rxswift/tree/main/RxSwift/Traits/PrimitiveSequence"
click node_cocoa_wrappers "https://github.com/reactivex/rxswift/tree/main/RxCocoa/iOS"
click node_delegate_proxy "https://github.com/reactivex/rxswift/blob/main/RxCocoa/Common/DelegateProxyType.swift"
click node_shared "https://github.com/reactivex/rxswift/blob/main/RxCocoa/Traits/SharedSequence/SharedSequence.swift"
click node_urlsession "https://github.com/reactivex/rxswift/blob/main/RxCocoa/Foundation/URLSession%2BRx.swift"
click node_relays "https://github.com/reactivex/rxswift/tree/main/RxRelay"
click node_blocking "https://github.com/reactivex/rxswift/blob/main/RxBlocking/BlockingObservable.swift"
click node_rxtest "https://github.com/reactivex/rxswift/blob/main/RxTest/Schedulers/TestScheduler.swift"
click node_geo_api "https://github.com/reactivex/rxswift/blob/main/RxExample/Extensions/CLLocationManager%2BRx.swift"
click node_geo_proxy "https://github.com/reactivex/rxswift/blob/main/RxExample/Extensions/RxCLLocationManagerDelegateProxy.swift"
click node_geo_service "https://github.com/reactivex/rxswift/blob/main/RxExample/RxExample/Services/GeolocationService.swift"
click node_image_service "https://github.com/reactivex/rxswift/blob/main/RxExample/RxExample/Services/ImageService.swift"
click node_reach_service "https://github.com/reactivex/rxswift/blob/main/RxExample/RxExample/Services/ReachabilityService.swift"
click node_reachability "https://github.com/reactivex/rxswift/blob/main/RxExample/RxExample/Services/Reachability.swift"
click node_activity "https://github.com/reactivex/rxswift/blob/main/RxExample/RxExample/Services/ActivityIndicator.swift"
click node_downloadable "https://github.com/reactivex/rxswift/blob/main/RxExample/RxExample/Services/DownloadableImage.swift"
click node_diff "https://github.com/reactivex/rxswift/blob/main/RxExample/RxDataSources/Differentiator/Diff.swift"
click node_section_model "https://github.com/reactivex/rxswift/blob/main/RxExample/RxDataSources/Differentiator/AnimatableSectionModelType.swift"
click node_changeset "https://github.com/reactivex/rxswift/blob/main/RxExample/RxDataSources/Differentiator/Changeset.swift"
click node_item_path "https://github.com/reactivex/rxswift/blob/main/RxExample/RxDataSources/Differentiator/ItemPath.swift"
click node_identity "https://github.com/reactivex/rxswift/blob/main/RxExample/RxDataSources/Differentiator/IdentifiableType.swift"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_observable,node_operators,node_subjects,node_schedulers,node_disposables,node_traits toneBlue
class node_cocoa_wrappers,node_delegate_proxy,node_shared,node_urlsession toneAmber
class node_relays,node_blocking,node_rxtest toneMint
class node_geo_api,node_geo_proxy,node_geo_service,node_image_service,node_reach_service,node_reachability,node_activity,node_downloadable toneRose
class node_diff,node_section_model,node_changeset,node_item_path,node_identity,node_caller toneIndigo
```

## Components

### Reactive Core

- [Observable Streams](https://github.com/reactivex/rxswift/blob/main/RxSwift/Observable.swift): `RxSwift/Observable.swift`
- [Stream Operators](https://github.com/reactivex/rxswift/tree/main/RxSwift/Observables): `RxSwift/Observables`
- [Subjects](https://github.com/reactivex/rxswift/tree/main/RxSwift/Subjects): `RxSwift/Subjects`
- [Schedulers](https://github.com/reactivex/rxswift/tree/main/RxSwift/Schedulers): `RxSwift/Schedulers`
- [Disposal](https://github.com/reactivex/rxswift/tree/main/RxSwift/Disposables): `RxSwift/Disposables`
- [Primitive Traits](https://github.com/reactivex/rxswift/tree/main/RxSwift/Traits/PrimitiveSequence): `RxSwift/Traits/PrimitiveSequence`

### Cocoa Integration

- [UI Wrappers](https://github.com/reactivex/rxswift/tree/main/RxCocoa/iOS): `RxCocoa/iOS`
- [Delegate Proxies](https://github.com/reactivex/rxswift/blob/main/RxCocoa/Common/DelegateProxyType.swift): `RxCocoa/Common/DelegateProxyType.swift`
- [Shared Sequences](https://github.com/reactivex/rxswift/blob/main/RxCocoa/Traits/SharedSequence/SharedSequence.swift): `RxCocoa/Traits/SharedSequence/SharedSequence.swift`
- [URLSession Adapter](https://github.com/reactivex/rxswift/blob/main/RxCocoa/Foundation/URLSession%2BRx.swift): `RxCocoa/Foundation/URLSession+Rx.swift`

### Supporting APIs

- [Relays](https://github.com/reactivex/rxswift/tree/main/RxRelay): `RxRelay`
- [Blocking API](https://github.com/reactivex/rxswift/blob/main/RxBlocking/BlockingObservable.swift): `RxBlocking/BlockingObservable.swift`
- [Virtual-Time Testing](https://github.com/reactivex/rxswift/blob/main/RxTest/Schedulers/TestScheduler.swift): `RxTest/Schedulers/TestScheduler.swift`

### Example App

- [Location Adapter](https://github.com/reactivex/rxswift/blob/main/RxExample/Extensions/CLLocationManager%2BRx.swift): `RxExample/Extensions/CLLocationManager+Rx.swift`
- [Location Proxy](https://github.com/reactivex/rxswift/blob/main/RxExample/Extensions/RxCLLocationManagerDelegateProxy.swift): `RxExample/Extensions/RxCLLocationManagerDelegateProxy.swift`
- [Geolocation Service](https://github.com/reactivex/rxswift/blob/main/RxExample/RxExample/Services/GeolocationService.swift): `RxExample/RxExample/Services/GeolocationService.swift`
- [Image Service](https://github.com/reactivex/rxswift/blob/main/RxExample/RxExample/Services/ImageService.swift): `RxExample/RxExample/Services/ImageService.swift`
- [Reachability Service](https://github.com/reactivex/rxswift/blob/main/RxExample/RxExample/Services/ReachabilityService.swift): `RxExample/RxExample/Services/ReachabilityService.swift`
- [Reachability Monitor](https://github.com/reactivex/rxswift/blob/main/RxExample/RxExample/Services/Reachability.swift): `RxExample/RxExample/Services/Reachability.swift`
- [Activity Indicator](https://github.com/reactivex/rxswift/blob/main/RxExample/RxExample/Services/ActivityIndicator.swift): `RxExample/RxExample/Services/ActivityIndicator.swift`
- [Image Result](https://github.com/reactivex/rxswift/blob/main/RxExample/RxExample/Services/DownloadableImage.swift): `RxExample/RxExample/Services/DownloadableImage.swift`

### Sectioned Data

- [Section Differencing](https://github.com/reactivex/rxswift/blob/main/RxExample/RxDataSources/Differentiator/Diff.swift): `RxExample/RxDataSources/Differentiator/Diff.swift`
- [Section Identity](https://github.com/reactivex/rxswift/blob/main/RxExample/RxDataSources/Differentiator/AnimatableSectionModelType.swift): `RxExample/RxDataSources/Differentiator/AnimatableSectionModelType.swift`
- [Changesets](https://github.com/reactivex/rxswift/blob/main/RxExample/RxDataSources/Differentiator/Changeset.swift): `RxExample/RxDataSources/Differentiator/Changeset.swift`
- [Item Paths](https://github.com/reactivex/rxswift/blob/main/RxExample/RxDataSources/Differentiator/ItemPath.swift): `RxExample/RxDataSources/Differentiator/ItemPath.swift`
- [Identity Types](https://github.com/reactivex/rxswift/blob/main/RxExample/RxDataSources/Differentiator/IdentifiableType.swift): `RxExample/RxDataSources/Differentiator/IdentifiableType.swift`

### Other components

- **Application**

## Connections

- Application → Observable Streams: creates streams (evidence: `README.md`)
- Observable Streams → Stream Operators: composes with (evidence: `README.md`)
- Application → UI Wrappers: observes UI (evidence: `README.md`)
- UI Wrappers → Delegate Proxies: wraps delegates (evidence: `RxCocoa/iOS/NSTextStorage+Rx.swift`)
- UI Wrappers → Shared Sequences: binds sequences (evidence: `README.md`)
- UI Wrappers → URLSession Adapter: adapts requests
- Observable Streams → Schedulers: schedules work (evidence: `README.md`)
- Observable Streams → Disposal: manages subscriptions (evidence: `README.md`)
- Observable Streams → Subjects: emits events (evidence: `README.md`)
- Observable Streams → Primitive Traits: specializes streams (evidence: `README.md`)
- Relays → Observable Streams: depends on (evidence: `README.md`)
- UI Wrappers → Relays: depends on (evidence: `README.md`)
- Blocking API → Observable Streams: depends on (evidence: `README.md`)
- Virtual-Time Testing → Observable Streams: depends on (evidence: `README.md`)
- Geolocation Service → Location Adapter: observes locations (evidence: `RxExample/RxExample/Services/GeolocationService.swift`)
- Location Adapter → Location Proxy: uses proxy (evidence: `RxExample/Extensions/CLLocationManager+Rx.swift`)
- Image Service → Reachability Service: retries by reachability (evidence: `RxExample/RxExample/Services/ImageService.swift`)
- Image Service → Activity Indicator: tracks loading (evidence: `RxExample/RxExample/Services/ImageService.swift`)
- Image Service → Image Result: emits image result (evidence: `RxExample/RxExample/Services/ImageService.swift`)
- Reachability Service → Reachability Monitor: starts monitor (evidence: `RxExample/RxExample/Services/ReachabilityService.swift`)
- Section Differencing → Section Identity: diffs sections (evidence: `RxExample/RxDataSources/Differentiator/Diff.swift`)
- Section Differencing → Item Paths: tracks item paths (evidence: `RxExample/RxDataSources/Differentiator/Diff.swift`)
- Section Differencing → Identity Types: indexes identities (evidence: `RxExample/RxDataSources/Differentiator/Diff.swift`)
- Section Differencing → Changesets: generates changesets (evidence: `RxExample/RxDataSources/Differentiator/Diff.swift`)
