An enumeration of the elements of a sequence or collection.

    @frozen struct EnumeratedSequence<Base> where Base : Sequence


    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"


    Instance Properties

    • var lazy: LazySequence<Self>

      A sequence containing the same elements as this sequence, but on which some operations, such as map and filter, are implemented lazily.

    • var underestimatedCount: Int

      A value less than or equal to the number of elements in the sequence, calculated nondestructively.

    Instance Methods


    Removed Members

    Instance Methods