DataProvider

public protocol DataProvider

Provides data for a DataSource. Its provided objects will be of type ValueType.

Its objects shall not be accessed directly, granting its usage throught its methods, allowing better compatibility among different kinds of data providers.

  • The type of the provided object.

    Declaration

    Swift

    associatedtype ValueType
  • The type for the index type.

    Declaration

    Swift

    associatedtype IndexType
  • The type for the section title.

    Declaration

    Swift

    associatedtype SectionTitleType
  • Returns the object of given ValueType at given indexPath, if exists.

    Declaration

    Swift

    subscript(index: IndexType) -> ValueType? { get }

    Parameters

    indexPath

    IndexPath to get object.

  • Returns the IndexPath for the given object, if found.

    Declaration

    Swift

    func path(for value: ValueType) -> IndexType?

    Parameters

    value

    Object to search.

    Return Value

    IndexPath.

  • Returns the numbers of provided sections.

    For one-dimentional arrays, will return 1.

    Declaration

    Swift

    func numberOfSections() -> Int

    Return Value

    Int.

  • Returns the number of objects in the given section.

    If given section does not exists, returns 0.

    Declaration

    Swift

    func numberOfItems(in section: Int) -> Int

    Parameters

    section

    The section to be inquired about how much provided objects it has.

    Return Value

    Int.

  • Returns the title for a given section.

    Declaration

    Swift

    func title(section: Int) -> SectionTitleType?