Contents

numberOfSections(in:)

Asks your data source object for the number of sections in the collection view.

Declaration

optional func numberOfSections(in collectionView: UICollectionView) -> Int

Parameters

  • collectionView:

    The collection view requesting this information.

Return Value

The number of sections in collectionView.

Discussion

If you don’t implement this method, the collection view uses a default value of 1.

See Also

Getting item and section metrics