---
title: "numberOfSections(in:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uitableviewdatasource/numberofsections(in:)"
---

# numberOfSections(in:)

Asks the data source to return the number of sections in the table view.

## Declaration

```swift
optional func numberOfSections(in tableView: UITableView) -> Int
```

## Parameters

- `tableView`: An object representing the table view requesting this information.

## Return Value

Return Value The number of sections in tableView.

## Discussion

Discussion If you don’t implement this method, the table configures the table with one section.

## See Also

### Providing the number of rows and sections

- [tableView(_:numberOfRowsInSection:)](uikit/uitableviewdatasource/tableview(_:numberofrowsinsection:).md)
