ModelListProvider

public protocol ModelListProvider

Warning

Although this has public access, it is intended for internal & codegen use and should not be used directly by host applications. The behavior of this may change without warning. Though it is not used by host application making any change to these public types should be backward compatible, otherwise it will be a breaking change.
  • Declaration

    Swift

    associatedtype Element : Model
  • Retrieve the array of Element from the data source.

    Declaration

    Swift

    func load() -> Result<[Element], CoreError>
  • Retrieve the array of Element from the data source asychronously.

    Declaration

    Swift

    func load(completion: @escaping (Result<[Element], CoreError>) -> Void)
  • Check if there is subsequent data to retrieve. This method always returns false if the underlying provider is not loaded. Make sure the underlying data is loaded by calling load(completion) before calling this method. If true, the next page can be retrieved using getNextPage(completion:).

    Declaration

    Swift

    func hasNextPage() -> Bool
  • Asynchronously retrieve the next page as a new in-memory List object. Returns a failure if there is no next page of results. You can validate whether the list has another page with hasNextPage().

    Declaration

    Swift

    func getNextPage(completion: @escaping (Result<List<Element>, CoreError>) -> Void)
  • Declaration

    Swift

    func eraseToAnyModelListProvider() -> AnyModelListProvider<Element>