Contents

numberOfSections(in:)

Asks your data source object to provide the total number of sections.

Declaration

@MainActor optional func numberOfSections(in collectionView: NSCollectionView) -> Int

Parameters

  • collectionView:

    The collection view requesting the information.

Return Value

The number of sections in the specified collection view.

Discussion

Implement this method when the organization of your data requires more than one section. If you do not implement this method, the collection view creates only one section.

See Also

Getting the Number of Sections and Items