Skip to content

Commit

Permalink
Merge pull request #38 from vadymmarkov/refactor/remove-rx
Browse files Browse the repository at this point in the history
Refactor: remove RxSwift as dependency
  • Loading branch information
vadymmarkov authored Nov 9, 2018
2 parents fee40d6 + ffef3fe commit 33335bb
Show file tree
Hide file tree
Showing 18 changed files with 48 additions and 693 deletions.
1 change: 0 additions & 1 deletion Cartfile

This file was deleted.

5 changes: 2 additions & 3 deletions Cartfile.resolved
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
github "Quick/Nimble" "v7.0.1"
github "Quick/Quick" "v1.1.0"
github "ReactiveX/RxSwift" "3.6.1"
github "Quick/Nimble" "v7.3.1"
github "Quick/Quick" "v1.3.2"
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ asynchronous code up to the next level.
* [Then](#then)
* [Recover](#recover)
* [When](#when)
* [Reactive extensions](#reactive-extensions)
* [Installation](#installation)
* [Author](#author)
* [Credits](#credits)
Expand Down Expand Up @@ -276,6 +277,33 @@ promise2.resolve("String")
promise3.resolve(3)
```

## Reactive extensions

Use the following extension in order to integrate **When** with [RxSwift](https://github.com/ReactiveX/RxSwift):

```swift
import RxSwift

extension Promise: ObservableConvertibleType {
public func asObservable() -> Observable<T> {
return Observable.create({ observer in
self
.done({ value in
observer.onNext(value)
})
.fail({ error in
observer.onError(error)
})
.always({ _ in
observer.onCompleted()
})

return Disposables.create()
})
}
}
```

## Installation

**When** is available through [CocoaPods](http://cocoapods.org). To install
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
25 changes: 0 additions & 25 deletions Sources/RxWhen/Promise+Rx.swift

This file was deleted.

File renamed without changes.
16 changes: 3 additions & 13 deletions When.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|
s.name = "When"
s.summary = "A lightweight implementation of Promises in Swift"
s.version = "3.0.3"
s.version = "3.1.0"
s.homepage = "https://github.com/vadymmarkov/When"
s.license = 'MIT'
s.author = { "Vadym Markov" => "[email protected]" }
Expand All @@ -16,16 +16,6 @@ Pod::Spec.new do |s|
s.tvos.deployment_target = '9.2'

s.requires_arc = true
s.default_subspec = "Core"

s.subspec "Core" do |ss|
ss.source_files = "Sources/When/**/*"
ss.framework = "Foundation"
end

s.subspec "RxSwift" do |ss|
ss.source_files = "Sources/RxWhen/**/*"
ss.dependency "When/Core"
ss.dependency "RxSwift", "4.0.0-beta.0"
end
ss.source_files = "Sources/**/*"
ss.framework = "Foundation"
end
Loading

0 comments on commit 33335bb

Please sign in to comment.