Skip to content

Commit 6ef79d1

Browse files
committed
Remove Rx targets
1 parent fee40d6 commit 6ef79d1

15 files changed

+42
-675
lines changed

README.md

+28
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ asynchronous code up to the next level.
3030
* [Then](#then)
3131
* [Recover](#recover)
3232
* [When](#when)
33+
* [Reactive extensions](#reactive-extensions)
3334
* [Installation](#installation)
3435
* [Author](#author)
3536
* [Credits](#credits)
@@ -276,6 +277,33 @@ promise2.resolve("String")
276277
promise3.resolve(3)
277278
```
278279

280+
## Reactive extensions
281+
282+
Use the following extension in order to integrate **When** with [RxSwift](https://github.com/ReactiveX/RxSwift):
283+
284+
```swift
285+
import RxSwift
286+
287+
extension Promise: ObservableConvertibleType {
288+
public func asObservable() -> Observable<T> {
289+
return Observable.create({ observer in
290+
self
291+
.done({ value in
292+
observer.onNext(value)
293+
})
294+
.fail({ error in
295+
observer.onError(error)
296+
})
297+
.always({ _ in
298+
observer.onCompleted()
299+
})
300+
301+
return Disposables.create()
302+
})
303+
}
304+
}
305+
```
306+
279307
## Installation
280308

281309
**When** is available through [CocoaPods](http://cocoapods.org). To install
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Sources/RxWhen/Promise+Rx.swift

-25
This file was deleted.
File renamed without changes.

0 commit comments

Comments
 (0)