mirror of
https://github.com/ReactiveX/RxSwift.git
synced 2024-10-06 06:57:43 +03:00
Adds concat
overload.
This commit is contained in:
parent
c66723de70
commit
3269f482c9
@ -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)
|
||||
}
|
||||
|
@ -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 {
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user