1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-26 23:36:08 +03:00
This commit is contained in:
Tae Won Ha 2019-03-23 10:48:24 +01:00
parent 31b756453b
commit bd37492b81
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44

View File

@ -16,14 +16,16 @@ extension ObservableType {
} }
} }
extension PrimitiveSequenceType where TraitType == CompletableTrait, ElementType == Never { extension PrimitiveSequenceType
where TraitType == CompletableTrait, ElementType == Never {
func andThen(using body: () -> Completable) -> Completable { func andThen(using body: () -> Completable) -> Completable {
return self.andThen(body()) return self.andThen(body())
} }
} }
extension PrimitiveSequence where Element == Never, TraitType == CompletableTrait { extension PrimitiveSequence
where Element == Never, TraitType == CompletableTrait {
func wait() throws { func wait() throws {
var trigger = false var trigger = false
@ -56,11 +58,18 @@ extension PrimitiveSequence where Element == Never, TraitType == CompletableTrai
extension PrimitiveSequence where TraitType == SingleTrait { extension PrimitiveSequence where TraitType == SingleTrait {
static func fromSinglesToSingleOfArray(_ singles: [Single<Element>]) -> Single<[Element]> { static func fromSinglesToSingleOfArray(
return Observable.merge(singles.map { $0.asObservable() }).toArray().asSingle() _ singles: [Single<Element>]
) -> Single<[Element]> {
return Observable
.merge(singles.map { $0.asObservable() })
.toArray()
.asSingle()
} }
func flatMapCompletable(_ selector: @escaping (Element) throws -> Completable) -> Completable { func flatMapCompletable(
_ selector: @escaping (Element) throws -> Completable
) -> Completable {
return self return self
.asObservable() .asObservable()
.flatMap { try selector($0).asObservable() } .flatMap { try selector($0).asObservable() }