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

    Type 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(@escaping () -> Element?)

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

    Instance members

    Citizens in Swift

    where Element:Copyable, Element:Escapable

    Conformances

    Instance features

    Show obsolete interfaces (1)

    Hide obsolete interfaces