<p align="center">
<img src="assets/RxSwift_Logo.png" width="35%" alt="RxSwift Logo" />
<br />
<a href="https://actions-badge.atrox.dev/ReactiveX/RxSwift/goto" target="_blank"><img src="https://github.com/ReactiveX/RxSwift/workflows/RxSwift/badge.svg?branch=main" alt="Build Status" /></a>
<img src="https://img.shields.io/badge/platforms-iOS%20%7C%20macOS%20%7C%20tvOS%20%7C%20watchOS%20%7C%20Linux-333333.svg" alt="Supported Platforms: iOS, macOS, tvOS, watchOS & Linux" />
<br />
<a href="https://cocoapods.org/pods/RxSwift" alt="RxSwift on CocoaPods" title="RxSwift on CocoaPods"><img src="https://img.shields.io/cocoapods/v/RxSwift.svg" /></a>
<a href="https://github.com/Carthage/Carthage" alt="RxSwift on Carthage" title="RxSwift on Carthage"><img src="https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat" /></a>
<a href="https://github.com/apple/swift-package-manager" alt="RxSwift on Swift Package Manager" title="RxSwift on Swift Package Manager"><img src="https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg" /></a>
</p>
Rx is a [generic abstraction of computation](https://youtu.be/looJcaeboBY) expressed through `Observable<Element>` 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](http://reactivex.io) standard.
<p align="center"><img src="assets/example.png" width="55%" alt="RxSwift Observable Example of a price constantly changing and updating the app's UI" /></p>
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](http://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](Documentation/GettingStarted.md#observables-aka-sequences). This is the reason why Rx is so simple, elegant and powerful.
## I came here because I want to ...
###### ... understand
* [why use rx?](Documentation/Why.md)
* [the basics, getting started with RxSwift](Documentation/GettingStarted.md)
* [traits](Documentation/Traits.md) - what are `Single`, `Completable`, `Maybe`, `Driver`, and `ControlProperty` ... and why do they exist?
* [testing](Documentation/UnitTests.md)
* [tips and common errors](Documentation/Tips.md)
* [debugging](Documentation/GettingStarted.md#debugging)
* [the math behind Rx](Documentation/MathBehindRx.md)
* [what are hot and cold observable sequences?](Documentation/HotAndColdObservables.md)
###### ... install
* Integrate RxSwift/RxCocoa with my app. [Installation Guide](#installation)
###### ... hack around
* with the example app. [Running Example App](Documentation/ExampleApp.md)
* with operators in playgrounds. [Playgrounds](Documentation/Playgrounds.md)
###### ... interact
* All of this is great, but it would be nice to talk with other people using RxSwift and exchange experiences. <br />[Join Slack Channel](http://slack.rxswift.org)
* Report a problem using the library. [Open an Issue With Bug Template](.github/ISSUE_TEMPLATE.md)
* Request a new feature. [Open an Issue With Feature Request Template](Documentation/NewFeatureRequestTemplate.md)
* Help out [Check out contribution guide](CONTRIBUTING.md)
###### ... compare
* [with Combine and ReactiveSwift](Documentation/ComparisonWithOtherLibraries.md).
###### ... 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](https://reactivex.io). 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](https://github.com/ReactiveX/RxSwift/blob/main/Documentation/Subjects.md#relays). It depends on `RxSwift`.
* **RxTest** and **RxBlocking**: Provides testing capabilities for Rx-based systems. It depends on `RxSwift`.
## Usage
<table>
<tr>
<th width="30%">Here's an example</th>
<th width="30%">In Action</th>
</tr>
<tr>
<td>Define search for GitHub repositories ...</td>
<th rowspan="9"><img src="https://raw.githubusercontent.com/kzaher/rxswiftcontent/master/GithubSearch.gif"></th>
</tr>
<tr>
<td><div class="highlight highlight-source-swift"><pre>
let searchResults = searchBar.rx.text.orEmpty
.throttle(.milliseconds(300), scheduler: MainScheduler.instance)
.distinctUntilChanged()
.flatMapLatest { query -> Observable<[Repository]> in
if query.isEmpty {
return .just([])
}
return searchGitHub(query)
.catchAndReturn([])
}
.observe(on: MainScheduler.instance)</pre></div></td>
</tr>
<tr>
<td>... then bind the results to your tableview</td>
</tr>
<tr>
<td width="30%"><div class="highlight highlight-source-swift"><pre>
searchResults
.bind(to: tableView.rx.items(cellIdentifier: "Cell")) {
(index, repository: Repository, cell) in
cell.textLabel?.text = repository.name
cell.detailTextLabel?.text = repository.url
}
.disposed(by: disposeBag)</pre></div></td>
</tr>
</table>
## Requirements
* Xcode 12.x
* Swift 5.x
For Xcode 11 and below, [use RxSwift 5.x](https://github.com/ReactiveX/RxSwift/releases/tag/5.1.1).
## Installation
RxSwift doesn't contain any external dependencies.
These are currently the supported installation options:
### Manual
Open Rx.xcworkspace, choose `RxExample` and hit run. This method will build everything and run the sample app
### [CocoaPods](https://guides.cocoapods.org/using/using-cocoapods.html)
```ruby
# Podfile
use_frameworks!
target 'YOUR_TARGET_NAME' do
pod 'RxSwift', '6.6.0'
pod 'RxCocoa', '6.6.0'
end
# RxTest and RxBlocking make the most sense in the context of unit/integration tests
target 'YOUR_TESTING_TARGET' do
pod 'RxBlocking', '6.6.0'
pod 'RxTest', '6.6.0'
end
```
Replace `YOUR_TARGET_NAME` and then, in the `Podfile` directory, type:
```bash
$ pod install
```
### XCFrameworks
Each release starting with RxSwift 6 includes `*.xcframework` framework binaries.
Simply drag the needed framework binaries to your **Frameworks, Libraries, and Embedded Content** section under your target's **General** tab.
> **Note**: If you're using `RxCocoa`, be sure to also drag **RxCocoaRuntime.xcframe
没有合适的资源?快使用搜索试试~ 我知道了~
RxSwift-main.zip
共1282个文件
swift:1019个
html:73个
md:26个
0 下载量 127 浏览量
2024-02-07
10:24:54
上传
评论
收藏 2.23MB ZIP 举报
温馨提示
Rx(Reactive Extensions)是一种通用的计算抽象模型,它通过 Observable 接口来表达。这种接口设计使得你可以通过可观测流来广播和订阅值以及其他事件。简单来说,就是提供一种方式,允许你创建数据流,并让其他部分以响应式的方式注册对这些数据变化的监听,从而在数据发生变化时获取通知并执行相应操作。
资源推荐
资源详情
资源评论
收起资源包目录
RxSwift-main.zip (1282个子文件)
contents 347B
jazzy.css 8KB
highlight.css 3KB
Dangerfile 1KB
Gemfile 72B
spinner.gif 2KB
.gitignore 829B
RXObjCRuntime+Testing.h 18KB
_RXObjCRuntime.h 4KB
_RXObjCRuntime.h 4KB
_RX.h 4KB
_RX.h 4KB
_RXKVOObserver.h 801B
_RXKVOObserver.h 801B
_RXDelegateProxy.h 741B
_RXDelegateProxy.h 741B
Differentiator.h 531B
RxDataSources.h 522B
RxCocoa.h 495B
RxCocoaRuntime.h 470B
RxCocoaRuntime.h 470B
RxTest-macOS-Bridging-Header.h 193B
RxTest-tvOS-Bridging-Header.h 192B
RxTest-iOS-Bridging-Header.h 191B
ObservableType.html 606KB
PrimitiveSequenceType.html 466KB
InfallibleType.html 260KB
PrimitiveSequence.html 89KB
Infallible.html 81KB
VirtualTimeScheduler.html 53KB
SerialDispatchQueueScheduler.html 48KB
ConcurrentDispatchQueueScheduler.html 41KB
RxSwift.html 40KB
CompositeDisposable.html 38KB
VirtualTimeConverterType.html 37KB
ConcurrentMainScheduler.html 37KB
Schedulers.html 36KB
BehaviorSubject.html 35KB
HistoricalSchedulerTimeConverter.html 34KB
DisposeBag.html 34KB
index.html 33KB
Event.html 33KB
ObservableConvertibleType.html 33KB
Other Enums.html 32KB
Disposables.html 32KB
PublishSubject.html 32KB
ObserverType.html 32KB
SubjectLifetimeScope.html 31KB
ReplaySubject.html 31KB
Disposables.html 30KB
AsyncSubject.html 30KB
SchedulerType.html 29KB
AnyObserver.html 29KB
RxError.html 28KB
OperationQueueScheduler.html 28KB
Subjects.html 28KB
Binder.html 27KB
MainScheduler.html 27KB
GroupedObservable.html 26KB
Hooks.html 26KB
ScheduledDisposable.html 26KB
ImmediateSchedulerType.html 26KB
CurrentThreadScheduler.html 25KB
PrimitiveSequence.html 25KB
Other Protocols.html 25KB
SingleAssignmentDisposable.html 25KB
RefCountDisposable.html 24KB
Reactive.html 24KB
SerialDisposable.html 24KB
BooleanDisposable.html 24KB
ReactiveCompatible.html 23KB
Traits.html 23KB
Other Typealiases.html 23KB
Other Extensions.html 23KB
InfallibleEvent.html 22KB
ConnectableObservableType.html 22KB
MaybeEvent.html 22KB
VirtualTimeComparison.html 22KB
Observable.html 22KB
Disposable.html 22KB
SubjectType.html 21KB
Resources.html 21KB
EventConvertible.html 21KB
HistoricalScheduler.html 21KB
CompletableEvent.html 21KB
TakeBehavior.html 21KB
ConnectableObservable.html 21KB
SingleEvent.html 20KB
DataDecoder.html 20KB
TakeUntilBehavior.html 20KB
Infallible.html 20KB
AsyncSequence.html 20KB
Cancelable.html 20KB
Other Classes.html 19KB
Other Global Variables.html 19KB
DisposableBuilder.html 19KB
Other Structs.html 18KB
jquery.min.js 88KB
typeahead.jquery.js 70KB
lunr.min.js 29KB
共 1282 条
- 1
- 2
- 3
- 4
- 5
- 6
- 13
资源评论
神气仙人
- 粉丝: 2072
- 资源: 101
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 词频统计pta.docx
- json入门教程.docx
- 知行评教(ver 0.1)
- v8390966-xhs-Guanfang_X64.apk
- 《STM32单片机+MAX30102心率血氧传感器+OLED屏幕+心率血氧数据发送到串口调试助手》源代码
- 刷机和解锁system分区全套软件
- vb6.0使用数据环境设计器dataenvoriment连接带密码的access数据库不成功解决办法
- wifiphisher-master
- 构建简单的社交网站时,Redis 可以作为一个非常有用的工具来存储和管理各种数据 以下是一些在构建社交网站时可以使用 Redis
- 分布式锁和信号量都是在分布式系统中用于控制并发访问的重要工具,它们有不同的特点和应用场景: 1. **分布式锁**:
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功