2016-08-04 21 views

回答

3

如果您在CollectionType上使用它,它可以處理超過8個。

Here's the method definition

extension CollectionType where Generator.Element : ObservableType { 
    public func zip<R>(resultSelector: [Generator.Element.E] throws -> R) -> Observable<R> { 
     return ZipCollectionType(sources: self, resultSelector: resultSelector) 
    } 
} 

因此,而不是使用這樣的:

Observable.zip(o1, o2, o3, o4, o5, o6, o7, o8, o9) { ... } 

使用方法如下:

[o1, o2, o3, o4, o5, o6, o7, o8, o9].zip { ... } 
+0

這很有趣,有沒有任何副作用? –

+0

沒有副作用。它的行爲就像'Observable.zip'。 – solidcell

+0

如果我正在閱讀該權利,它會將該集合視爲一組源觀察對象,然後在它們散發時將它們拉動?那是對的嗎? –