CollectionDataProvider

public protocol CollectionDataProvider : DataProvider

CollectionDataProvider provides an interface for data providers which rely on a collection as internal data structure. By conforming to this protocol you get most of the DataProvider requirements already implemented.

  • Undocumented

    Declaration

    Swift

    associatedtype Container : Collection where Self.Element == Self.Container.Element.Element, Self.Container.Element : Collection
  • The content which is provided by the data provider

    Declaration

    Swift

    var content: Container { get }
  • numberOfSections() Extension method

    Return the number of sections.

    Declaration

    Swift

    func numberOfSections() -> Int

    Return Value

    the number of sections.

Available where Container.Index == Int, Container.Element.Index == Int

  • object(at:) Extension method

    Returns an object for a given index path.

    Declaration

    Swift

    func object(at indexPath: IndexPath) -> Element

    Parameters

    indexPath

    the index path to get the object for.

    Return Value

    the object at the given index path.

  • numberOfItems(inSection:) Extension method

    Returns the number of items in a given section.

    Declaration

    Swift

    func numberOfItems(inSection section: Int) -> Int

    Parameters

    section

    the section.

    Return Value

    number of items in the given section.

Available where Element: Equatable

  • indexPath(for:) Extension method

    Returns the indexPath for a given object.

    • return: the indexPath of the object, if available.

    Declaration

    Swift

    func indexPath(for object: Element) -> IndexPath?

    Parameters

    object

    the object to find the indexPath for.