IGListSupplementaryViewSource

Objective-C

@protocol IGListSupplementaryViewSource <NSObject>

Swift

protocol ListSupplementaryViewSource : NSObjectProtocol

Conform to 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() -> [String]

    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.

    Note

    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: String, at index: Int) -> UICollectionReusableView

    Parameters

    elementKind

    The kind of supplementary view being requested

    index

    The index for the supplementary veiw 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: String, at index: Int) -> CGSize

    Parameters

    elementKind

    The kind of supplementary view.

    index

    The index of the requested view.

    Return Value

    The size for the supplementary view.