StructureSwift5.9.0

    AnyIterator

    A type-erased iterator of Element.

    @frozen struct AnyIterator<Element>

    This iterator forwards its next() method to an arbitrary underlying iterator having the same Element type, hiding the specifics of the underlying IteratorProtocol.

    Citizens in Swift

    Conformances

    Members

    • init<I>(I)

      Creates an iterator that wraps a base iterator but whose type depends only on the base iterator’s element type.

    • init(() -> Element?)

      Creates an iterator that wraps the given closure in its next() method.

    • func next() -> Element?

      Advances to the next element and returns it, or nil if no next element exists.

    Features