Zip2Sequence

    A sequence of pairs built out of two underlying sequences.

    @frozen struct Zip2Sequence<Sequence1, Sequence2> where Sequence1 : Sequence, Sequence2 : Sequence

    In a Zip2Sequence instance, the elements of the ith pair are the ith elements of each underlying sequence. To create a Zip2Sequence instance, use the zip(_:_:) function.

    The following example uses the zip(_:_:) function to iterate over an array of strings and a countable range at the same time:

    let words = ["one", "two", "three", "four"]
    let numbers = 1...4
    
    for (word, number) in zip(words, numbers) {
        print("\(word): \(number)")
    }
    // Prints "one: 1"
    // Prints "two: 2"
    // Prints "three: 3"
    // Prints "four: 4"

    Citizens in Swift

    where Sequence1:Sequence, Sequence1:Sendable, Sequence2:Sequence, Sequence2:Sendable

    Conformances

    Citizens in Swift

    where Sequence1:Sequence, Sequence2:Sequence

    Conformances

    Types

    Typealiases

    Show obsolete interfaces (2)

    Hide obsolete interfaces

    Instance members

    Instance features

    Show obsolete interfaces (1)

    Hide obsolete interfaces