Adds concat overload.

This commit is contained in:
Krunoslav Zaher 2015-10-18 15:24:53 +02:00
parent c66723de70
commit 3269f482c9
2 changed files with 15 additions and 2 deletions

View File

@ -61,8 +61,8 @@ class GitHubAPI {
func signup(username: String, password: String) -> Observable<SignupState> {
// this is also just a mock
let signupResult = SignupState.SignedUp(signedUp: arc4random() % 5 == 0 ? false : true)
return [just(signupResult), never()]
.concat()
return just(signupResult)
.concat(never())
.throttle(2, MainScheduler.sharedInstance)
.startWith(SignupState.SigningUp)
}

View File

@ -58,6 +58,19 @@ extension ObservableType where E : ObservableConvertibleType {
// concat
extension ObservableType {
/**
Concatenates the second observable sequence to `self` upon successful termination of `self`.
- parameter second: Second observable sequence.
- returns: An observable sequence that contains the elements of `self`, followed by those of the second sequence.
*/
public func concat<O: ObservableConvertibleType where O.E == E>(second: O) -> Observable<E> {
return [self.asObservable(), second.asObservable()].concat()
}
}
extension SequenceType where Generator.Element : ObservableConvertibleType {
/**