<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 10.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UICollectionViewDataSourcePrefetching/collectionView(_:cancelPrefetchingForItemsAt:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UICollectionViewDataSourcePrefetching(im)collectionView:cancelPrefetchingForItemsAtIndexPaths:"
  },
  "title" : "collectionView(_:cancelPrefetchingForItemsAt:)"
}
-->

# collectionView(_:cancelPrefetchingForItemsAt:)

Cancels a previously triggered data prefetch request.

```
optional func collectionView(_ collectionView: UICollectionView, cancelPrefetchingForItemsAt indexPaths: [IndexPath])
```

## Parameters

`collectionView`

The collection view issuing the cancellation of the prefetch request.

`indexPaths`

The index paths that specify the locations of the items for which data is no longer required.

## Discussion

The collection view calls this method to cancel prefetch requests as cells scroll out of view. Your implementation of this method is responsible for canceling the operations initiated by a previous call to [`collectionView(_:prefetchItemsAt:)`](/documentation/UIKit/UICollectionViewDataSourcePrefetching/collectionView(_:prefetchItemsAt:)). For further information about canceling an asynchronous data loading task, see [Concurrency Programming Guide](https://developer.apple.com/library/archive/documentation/General/Conceptual/ConcurrencyProgrammingGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40008091).

---

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)