fix
杨锴
2025-06-16 3fa53409f5132333ce6d83fff796e108ddd62090
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//
//  Infallible+CombineLatest+Collection.swift
//  RxSwift
//
//  Created by Hal Lee on 4/11/23.
//  Copyright © 2023 Krunoslav Zaher. All rights reserved.
//
 
import Foundation
 
extension InfallibleType {
    /**
     Merges the specified observable sequences into one observable sequence by using the selector function whenever any of the observable sequences produces an element.
 
     - seealso: [combinelatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)
 
     - parameter resultSelector: Function to invoke whenever any of the sources produces an element.
     - returns: An observable sequence containing the result of combining elements of the sources using the specified result selector function.
     */
    public static func combineLatest<Collection: Swift.Collection>(_ collection: Collection, resultSelector: @escaping ([Collection.Element.Element]) throws -> Element) -> Infallible<Element>
        where Collection.Element: InfallibleType {
        Infallible(CombineLatestCollectionType(sources: collection, resultSelector: resultSelector))
    }
 
    /**
     Merges the specified observable sequences into one observable sequence whenever any of the observable sequences produces an element.
 
     - seealso: [combinelatest operator on reactivex.io](http://reactivex.io/documentation/operators/combinelatest.html)
 
     - returns: An observable sequence containing the result of combining elements of the sources.
     */
    public static func combineLatest<Collection: Swift.Collection>(_ collection: Collection) -> Infallible<[Element]>
        where Collection.Element: InfallibleType, Collection.Element.Element == Element {
        Infallible(CombineLatestCollectionType(sources: collection) { $0 })
    }
}