The iterator for Enumerated
.
SDK
- Xcode 10.2+
Framework
- Swift Standard Library
Declaration
@frozen struct Iterator
Overview
An instance of this iterator wraps a base iterator and yields successive Int
values, starting at zero, along with the elements of the underlying base iterator. The following example enumerates the elements of an array:
var iterator = ["foo", "bar"].enumerated().makeIterator()
iterator.next() // (0, "foo")
iterator.next() // (1, "bar")
iterator.next() // nil
To create an instance, call enumerated().make
on a sequence or collection.