---
title: numberOfSections
framework: appkit
role: symbol
role_heading: Instance Property
path: appkit/nscollectionview/numberofsections
---

# numberOfSections

The number of sections in the collection view.

## Declaration

```swift
var numberOfSections: Int { get }
```

## Discussion

Discussion This property contains the number of sections reported by the data source object. If the collection view does not use a data source object, the value in this property is 1.

## See Also

### Getting the State of the Collection View

- [numberOfItems(inSection:)](appkit/nscollectionview/numberofitems(insection:).md)
