---
title: EnumeratedSequence
framework: swift
role: symbol
role_heading: Structure
path: swift/enumeratedsequence
---

# EnumeratedSequence

An enumeration of the elements of a sequence or collection.

## Declaration

```swift
@frozen struct EnumeratedSequence<Base> where Base : Sequence
```

## Overview

Overview EnumeratedSequence is a sequence of pairs (n, x), where ns are consecutive Int values starting at zero, and xs are the elements of a base sequence. To create an instance of EnumeratedSequence, call enumerated() on a sequence or collection. The following example enumerates the elements of an array. var s = ["foo", "bar"].enumerated() for (n, x) in s {     print("\(n): \(x)") } // Prints "0: foo" // Prints "1: bar"

## Topics

### Default Implementations

- [BidirectionalCollection Implementations](swift/enumeratedsequence/bidirectionalcollection-implementations.md)
- [Collection Implementations](swift/enumeratedsequence/collection-implementations.md)
- [RandomAccessCollection Implementations](swift/enumeratedsequence/randomaccesscollection-implementations.md)
- [Sequence Implementations](swift/enumeratedsequence/sequence-implementations.md)

## Relationships

### Conforms To

- [BidirectionalCollection](swift/bidirectionalcollection.md)
- [Collection](swift/collection.md)
- [Copyable](swift/copyable.md)
- [Escapable](swift/escapable.md)
- [RandomAccessCollection](swift/randomaccesscollection.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)
- [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)
- [Zip2Sequence](swift/zip2sequence.md)
