Instance Method

collectionView(_:cancelPrefetchingForItemsAt:)

Cancels a previously triggered data prefetch request.

Declaration

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:).For further information about canceling an asynchronous data loading task, see Concurrency Programming Guide.