<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "tvOS: -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UITableViewDataSourcePrefetching",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UITableViewDataSourcePrefetching"
  },
  "title" : "UITableViewDataSourcePrefetching"
}
-->

# UITableViewDataSourcePrefetching

A protocol that provides advance warning of the data requirements for a table view, allowing you to start potentially long-running data operations early.

```
@MainActor protocol UITableViewDataSourcePrefetching : NSObjectProtocol
```

## Overview

You use a prefetch data source object in conjunction with your table view’s data source to begin loading data for cells before the [`tableView(_:cellForRowAt:)`](/documentation/UIKit/UITableViewDataSource/tableView(_:cellForRowAt:)) data source method is called. The following steps are required to support a prefetch data source to your table view:

- Create the table view and its regular data source.
- Create an object that adopts the [`UITableViewDataSourcePrefetching`](/documentation/UIKit/UITableViewDataSourcePrefetching) protocol, and assign it to the [`prefetchDataSource`](/documentation/UIKit/UITableView/prefetchDataSource) property on the table view.
- Initiate asynchronous loading of the data required for the cells at the specified index paths in your implementation of [`tableView(_:prefetchRowsAt:)`](/documentation/UIKit/UITableViewDataSourcePrefetching/tableView(_:prefetchRowsAt:)).
- Prepare the cell for display using the prefetched data in your [`tableView(_:cellForRowAt:)`](/documentation/UIKit/UITableViewDataSource/tableView(_:cellForRowAt:)) data source method.
- Cancel pending data load operations when the table view informs you that the data is no longer required in the [`tableView(_:cancelPrefetchingForRowsAt:)`](/documentation/UIKit/UITableViewDataSourcePrefetching/tableView(_:cancelPrefetchingForRowsAt:)) method.

> Note:
> The prefetch method isn’t necessarily called for every cell in the table view. For details about a suggested approach to loading data, see <doc://com.apple.uikit/documentation/UIKit/UITableViewDataSourcePrefetching#Load-data-asynchronously>.

When configuring the table view object, assign your prefetch data source to its [`prefetchDataSource`](/documentation/UIKit/UITableView/prefetchDataSource) property. For more information about how a table view works, see [`UITableView`](/documentation/UIKit/UITableView).

### Load data asynchronously

The [`tableView(_:prefetchRowsAt:)`](/documentation/UIKit/UITableViewDataSourcePrefetching/tableView(_:prefetchRowsAt:)) method isn’t necessarily called for every cell in the table view. Your implementation of [`tableView(_:cellForRowAt:)`](/documentation/UIKit/UITableViewDataSource/tableView(_:cellForRowAt:)) must therefore be able to cope with the following potential situations:

- Data has been loaded via the prefetch request, and is ready to be displayed.
- Data is currently being prefetched, but isn’t yet available.
- Data hasn’t yet been requested.

One approach that handles all of these situations is to use <doc://com.apple.documentation/documentation/Foundation/Operation> to load the data for each row. You create the <doc://com.apple.documentation/documentation/Foundation/Operation> object and store it in the prefetch method. The data source method can then either retrieve the operation and the result, or create it if it doesn’t exist. For further information about how you can use asynchronous programming models to achieve this desired behavior, see [Concurrency Programming Guide](https://developer.apple.com/library/archive/documentation/General/Conceptual/ConcurrencyProgrammingGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40008091).

## Topics

### Fetching the row data

[`tableView(_:prefetchRowsAt:)`](/documentation/UIKit/UITableViewDataSourcePrefetching/tableView(_:prefetchRowsAt:))

Instructs your prefetch data source object to begin preparing data for the cells at the supplied index paths.

[`tableView(_:cancelPrefetchingForRowsAt:)`](/documentation/UIKit/UITableViewDataSourcePrefetching/tableView(_:cancelPrefetchingForRowsAt:))

Cancels a previously triggered data prefetch request.



---

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)