Avatar
extension ZipSequence.Iterator: IteratorProtocol { // The result of `next` is a tuple containing an `Element` of `S1`, an // `Element` of `S2` and an element of each member of `Ss` func next() -> (S1.Element, S2.Element, Ss.Element...)? { if reachedEnd { return nil } // We are going to talk about `project` later, in the *detailed design* // section // Moreover, please note that a variadic value of optional elements can be // directly used in pattern matching expressions guard let e1 = baseStream1.next(), let e2 = baseStream2.next(), let es = otherStreams.project({ $0.next() }) else { reachedEnd = true return nil } return (e1, e2, es...) } }
4:12 PM
ここで展開してるからいいのかな。