PagedCollection

public class PagedCollection<SingleElement> where SingleElement : Decodable, SingleElement : Encodable

A collection that fetches paged results in a lazy fashion.

Properties

  • Undocumented

    Declaration

    Swift

    public typealias Element = [SingleElement]
  • Returns the current running list of items.

    Declaration

    Swift

    public var items: Element? { get }
  • Returns the subset of items that corresponds to the current page.

    Declaration

    Swift

    public var pageItems: Element? { get }
  • Returns the count of items that have been retrieved so far. There may be additional results, not yet fetched.

    Declaration

    Swift

    public var underestimatedCount: Int { get }
  • Returns true if there are no more results to fetch.

    Declaration

    Swift

    public var isExhausted: Bool { get }
  • Undocumented

    See more

    Declaration

    Swift

    public struct PagedItemSyncIterator : Sequence, IteratorProtocol
  • Returns a iterator to retrieve paged items one at a time.

    Declaration

    Swift

    public var syncIterator: PagedItemSyncIterator { get }

Initializers

Public Methods

  • Retrieves the next page of results asynchronously.

    Declaration

    Swift

    public func nextPage(completionHandler: @escaping Continuation<Element>)
  • nextPage() Asynchronous

    Undocumented

    Declaration

    Swift

    public func nextPage() async throws -> [SingleElement]
  • Retrieves the next item in the collection, automatically fetching new pages when needed.

    Declaration

    Swift

    public func nextItem(completionHandler: @escaping Continuation<SingleElement>)
  • nextItem() Asynchronous

    Undocumented

    Declaration

    Swift

    public func nextItem() async throws -> SingleElement
  • Undocumented

    Declaration

    Swift

    public func forEachPage(progressHandler: @escaping (Element) -> Bool)
  • Undocumented

    Declaration

    Swift

    public func forEachItem(progressHandler: @escaping (SingleElement) -> Bool)