RangeReplaceableCollection

extension RangeReplaceableCollection
  • Creates a collection containing the elements of a cursor.

    // [String]
    let cursor = try String.fetchCursor(db, ...)
    let strings = try Array(cursor)
    

    Declaration

    Swift

    public init(_ cursor: some Cursor<Element>) throws

    Parameters

    cursor

    The cursor whose elements feed the collection.

  • Creates a collection containing the elements of a cursor.

    // [String]
    let cursor = try String.fetchCursor(db, ...)
    let strings = try Array(cursor, minimumCapacity: 100)
    

    Declaration

    Swift

    public init(_ cursor: some Cursor<Element>, minimumCapacity: Int) throws

    Parameters

    cursor

    The cursor whose elements feed the collection.

    minimumCapacity

    Prepares the returned collection to store the specified number of elements.

  • Adds the elements of a cursor to the end of this collection.

    In case of error, an unspecified amount of elements have been added to the collection.

    Declaration

    Swift

    public mutating func append(contentsOf newElements: some Cursor<Element>) throws

    Parameters

    newElements

    The elements to append to the collection.