---
title: "numberOfRows(in:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstableviewdatasource/numberofrows(in:)"
---

# numberOfRows(in:)

Returns the number of records managed for aTableView by the data source object.

## Declaration

```swift
@MainActor optional func numberOfRows(in tableView: NSTableView) -> Int
```

## Parameters

- `tableView`: The table view that sent the message.

## Return Value

Return Value The number of rows in aTableView.

## Discussion

Discussion An instance of NSTableView uses this method to determine how many rows it should create and display. Your numberOfRows(in:) implementation is called very frequently, so it must be efficient. Both view-based table views and cell-based table views must implement this method. note: This method is mandatory unless your application is using Cocoa bindings for providing data to the table view.

## See Also

### Related Documentation

- [NSTableView](appkit/nstableview.md)

### Getting Values

- [tableView(_:objectValueFor:row:)](appkit/nstableviewdatasource/tableview(_:objectvaluefor:row:).md)
