---
title: "stopCachingImages(for:targetSize:contentMode:options:)"
framework: photos
role: symbol
role_heading: Instance Method
path: "photos/phcachingimagemanager/stopcachingimages(for:targetsize:contentmode:options:)"
---

# stopCachingImages(for:targetSize:contentMode:options:)

Cancels image preparation for the specified assets and options.

## Declaration

```swift
func stopCachingImages(for assets: [PHAsset], targetSize: CGSize, contentMode: PHImageContentMode, options: PHImageRequestOptions?)
```

## Parameters

- `assets`: The array of specific doc://com.apple.photokit/documentation/Photos/PHAsset objects for which image preparation is in progress but is no longer needed.
- `targetSize`: The target size with which you requested image preparation.
- `contentMode`: The content mode with which you requested image preparation.
- `options`: The options with which you requested image preparation.

## Discussion

Discussion This method cancels image preparation for the specified assets with the specified options. Use it when image preparation that might be in progress is no longer needed. For example, if you prepare images for a collection view filled with photo thumbnails and then the user chooses a different thumbnail size for your collection view, call this method to cancel generating thumbnail images at the old size.

## See Also

### Preparing Images

- [startCachingImages(for:targetSize:contentMode:options:)](photos/phcachingimagemanager/startcachingimages(for:targetsize:contentmode:options:).md)
- [stopCachingImagesForAllAssets()](photos/phcachingimagemanager/stopcachingimagesforallassets().md)
