EnumeratedCursor

public final class EnumeratedCursor<Base: Cursor> : Cursor

An enumeration of the elements of a cursor.

To create an instance of EnumeratedCursor, call the enumerated() method on a cursor:

let cursor = try String.fetchCursor(db, "SELECT 'foo' UNION ALL SELECT 'bar'")
let c = cursor.enumerated()
while let (n, x) = c.next() {
    print("\(n): \(x)")
}
// Prints: "0: foo"
// Prints: "1: bar"
  • Advances to the next element and returns it, or nil if no next element exists.

    Declaration

    Swift

    public func next() throws -> (Int, Base.Element)?