EnumerateSequence

struct EnumerateSequence<Base : SequenceType>

The SequenceType returned by enumerate(). EnumerateSequence is a sequence of pairs (n, x), where ns are consecutive Ints starting at zero, and xs are the elements of a Base SequenceType:

var s = EnumerateSequence(["foo", "bar"])
Array(s) // [(0, "foo"), (1, "bar")]

Note:: idiomatic usage is to call enumerate instead of constructing an EnumerateSequence directly.

Inheritance SequenceType, _SequenceType, _Sequence_Type View Protocol Hierarchy →
Associated Types
Generator = EnumerateGenerator<Base.Generator>

Type alias inferred.

Element = Generator.Element

Type alias inferred.

Import import Swift

Initializers

init(_:)

Construct from a Base sequence

Declaration

init(_ base: Base)

Instance Methods

func generate()

Return a generator over the elements of this sequence.

Complexity: O(1)

Declaration

func generate() -> EnumerateGenerator<Base.Generator>