Permalink
Browse files

Merge branch 'doc_updates' into develop

  • Loading branch information...
kzaher committed Jun 7, 2018
2 parents a781fde + c888528 commit 081a064638fa9c53b1cacaa69bc74504f7a91dfe
View
@@ -11,6 +11,9 @@ All notable changes to this project will be documented in this file.
* Add `Single.flatMapMaybe(_:)` and `Single.asMaybe()`
* Add `UICollectionView.rx.prefetchItems`, `UICollectionView.rx.cancelPrefetchingForItems`, `UITableView.rx.prefetchRows`, and `UITableView.rx.cancelPrefetchingForRows`.
* Add `Single.flatMapCompletable()`
* Add `Single.asCompletable()`
* Fixes various spelling mistakes and missing parameters.
* Update `ignoreElements` comment.
#### Anomalies
@@ -21,7 +24,6 @@ All notable changes to this project will be documented in this file.
#### Anomalies
* Fixes ambiguity issue with `Single.do(onNext:onError:onSubscribe:onSubscribed:onDispose:)` and `Single.do(onSuccess:onError:onSubscribe:onSubscribed:onDispose:)`.
* Fixes various spelling mistakes and missing parameters.
## [4.1.1](https://github.com/ReactiveX/RxSwift/releases/tag/4.1.1)
@@ -69,7 +69,7 @@ These are called marble diagrams. There are more marble diagrams at [rxmarbles.c
If we were to specify sequence grammar as a regular expression it would look like:
**next* (error | completed)?**
**next\* (error | completed)?**
This describes the following:
@@ -594,7 +594,7 @@ Almost all operators are demonstrated in [Playgrounds](../Rx.playground).
To use playgrounds please open `Rx.xcworkspace`, build `RxSwift-macOS` scheme and then open playgrounds in `Rx.xcworkspace` tree view.
In case you need an operator, and don't know how to find it there a [decision tree of operators](http://reactivex.io/documentation/operators.html#tree).
In case you need an operator, and don't know how to find it there is a [decision tree of operators](http://reactivex.io/documentation/operators.html#tree).
### Custom operators
View
@@ -430,7 +430,7 @@ extension Reactive where Base: UISearchBar {
.startWith(text)
}
let bindingObserver = UIBindingObserver(UIElement: self.base) { (searchBar, text: String?) in
let bindingObserver = Binder(self.base) { (searchBar, text: String?) in
searchBar.text = text
}
@@ -25,7 +25,7 @@ extension ObservableType {
extension ObservableType {
/**
Skips elements and completes (or errors) when the receiver completes (or errors). Equivalent to filter that always returns false.
Skips elements and completes (or errors) when the observable sequence completes (or errors). Equivalent to filter that always returns false.
- seealso: [ignoreElements operator on reactivex.io](http://reactivex.io/documentation/operators/ignoreelements.html)
@@ -225,8 +225,6 @@ fileprivate class MergeLimitedSink<SourceElement, SourceSequence: ObservableConv
init(maxConcurrent: Int, observer: Observer, cancel: Cancelable) {
_maxConcurrent = maxConcurrent
let _ = _group.insert(_sourceSubscription)
super.init(observer: observer, cancel: cancel)
}
@@ -327,4 +327,11 @@ extension PrimitiveSequenceType where TraitType == SingleTrait {
public func asMaybe() -> Maybe<ElementType> {
return Maybe(raw: primitiveSequence.source)
}
/// Converts `self` to `Completable` trait.
///
/// - returns: Completable trait that represents `self`.
public func asCompletable() -> Completable {
return primitiveSequence.source.ignoreElements()
}
}
@@ -710,6 +710,8 @@ final class SingleTest_ : SingleTest, RxTestCase {
("test_flatMapMaybe", SingleTest.test_flatMapMaybe),
("test_flatMapCompletable", SingleTest.test_flatMapCompletable),
("test_asMaybe", SingleTest.test_asMaybe),
("test_asCompletable", SingleTest.test_asCompletable),
("test_asCompletableError", SingleTest.test_asCompletableError),
("test_zip_tuple", SingleTest.test_zip_tuple),
("test_zip_resultSelector", SingleTest.test_zip_resultSelector),
("testZipCollection_selector", SingleTest.testZipCollection_selector),
@@ -585,6 +585,30 @@ extension SingleTest {
.completed(200)
])
}
func test_asCompletable() {
let scheduler = TestScheduler(initialClock: 0)
let res = scheduler.start {
(Single<Int>.just(5).asCompletable() as Completable).asObservable()
}
XCTAssertEqual(res.events, [
.completed(200)
])
}
func test_asCompletableError() {
let scheduler = TestScheduler(initialClock: 0)
let res = scheduler.start {
(Single<Int>.error(testError).asCompletable() as Completable).asObservable()
}
XCTAssertEqual(res.events, [
.error(200, testError)
])
}
}
extension SingleTest {

0 comments on commit 081a064

Please sign in to comment.