IGListSupplementaryViewSource

@protocol IGListSupplementaryViewSource <NSObject>

Implement the methods of this protocol to provide information about a list’s supplementary views. This data is used in IGListAdapter which then configures and maintains a UICollectionView. The supplementary API reflects that in UICollectionView, UICollectionViewLayout, and UICollectionViewDataSource.

  • Asks the SupplementaryViewSource for an array of supported element kinds.

    Declaration

    Objective-C

    - (nonnull NSArray<NSString *> *)supportedElementKinds;

    Swift

    func supportedElementKinds() -> Any!

    Return Value

    An array of element kind strings that the supplementary source handles.

  • Asks the SupplementaryViewSource for a configured supplementary view for the specified kind and index.

    @discussion This is your opportunity to do any supplementary view setup and configuration.

    Warning

    You should never allocate new views in this method. Instead deque a view from the IGListCollectionContext.

    Declaration

    Objective-C

    - (nonnull __kindof UICollectionReusableView *)
    viewForSupplementaryElementOfKind:(nonnull NSString *)elementKind
                              atIndex:(NSInteger)index;

    Swift

    func viewForSupplementaryElement(ofKind elementKind: Any!, atIndex index: Any!) -> Any!

    Parameters

    elementKind

    The kind of supplementary view being requested

    index

    The index for the row being requested.

  • Asks the SupplementaryViewSource for the size of a supplementary view for the given kind and index path.

    Declaration

    Objective-C

    - (CGSize)sizeForSupplementaryViewOfKind:(nonnull NSString *)elementKind
                                     atIndex:(NSInteger)index;

    Swift

    func sizeForSupplementaryView(ofKind elementKind: Any!, atIndex index: Any!) -> Any!

    Parameters

    elementKind

    The kind of supplementary view.

    index

    The index of the requested row.

    Return Value

    The size for the supplementary view.