---
title: Zip2Sequence
framework: swift
role: symbol
role_heading: Structure
path: swift/zip2sequence
---

# Zip2Sequence

A sequence of pairs built out of two underlying sequences.

## Declaration

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

## Overview

Overview 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"

## Topics

### Type Aliases

- [Zip2Sequence.Stream1](swift/zip2sequence/stream1.md)
- [Zip2Sequence.Stream2](swift/zip2sequence/stream2.md)

### Default Implementations

- [Sequence Implementations](swift/zip2sequence/sequence-implementations.md)

## Relationships

### Conforms To

- [Copyable](swift/copyable.md)
- [Escapable](swift/escapable.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)
- [Sequence](swift/sequence.md)

## See Also

### Wrappers for Algorithms

- [CollectionDifference](swift/collectiondifference.md)
- [DropFirstSequence](swift/dropfirstsequence.md)
- [DropWhileSequence](swift/dropwhilesequence.md)
- [EnumeratedSequence](swift/enumeratedsequence.md)
- [FlattenCollection](swift/flattencollection.md)
- [FlattenSequence](swift/flattensequence.md)
- [JoinedSequence](swift/joinedsequence.md)
- [PrefixSequence](swift/prefixsequence.md)
- [Repeated](swift/repeated.md)
- [ReversedCollection](swift/reversedcollection.md)
- [StrideTo](swift/strideto.md)
- [StrideThrough](swift/stridethrough.md)
- [UnfoldSequence](swift/unfoldsequence.md)
