<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UITableViewDataSource/numberOfSections(in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UITableViewDataSource(im)numberOfSectionsInTableView:"
  },
  "title" : "numberOfSections(in:)"
}
-->

# numberOfSections(in:)

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

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

## Parameters

`tableView`

An object representing the table view requesting this information.

## Return Value

The number of sections in `tableView`.

## Discussion

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

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)