Provides methods for retrieving or generating preview thumbnails and full-size image or video data associated with Photos assets.


Use these methods to fetch full-size photo assets or thumbnail images, or to retrieve AV Foundation objects for playing, exporting, and manipulating video assets.

To load image or video data:

  1. Use the PHAsset class to fetch the asset you’re interested in.

  2. Call the default() method to retrieve the shared image manager object.

  3. Use one of the methods listed in Requesting Images and Requesting Video Objects to load the asset’s image or video data.

The image manager caches the asset images and data it provides, so later requests for the same assets with similar parameters will return results more quickly.

If you need to load image data for many assets together, use the PHCachingImageManager class to “preheat” the cache by loading images you expect to need soon. For example, when populating a collection view with photo asset thumbnails, you can cache images ahead of the current scroll position.


Getting the Image Manager

class func `default`()

Returns the shared image manager object.

Requesting Video Objects

func requestAVAsset(forVideo: PHAsset, options: PHVideoRequestOptions?, resultHandler: (AVAsset?, AVAudioMix?, [AnyHashable : Any]?) -> Void)

Requests AV Foundation objects representing the video asset’s content and state, to be loaded asynchronously.

Canceling a Request

func cancelImageRequest(PHImageRequestID)

Cancels an asynchronous request


Image Request Target Sizes

Special values for the targetSize parameter of the requestImage(for:targetSize:contentMode:options:resultHandler:) method.


A numeric identifier for an asynchronous image request.

Image Request Identifiers

Special values for the PHImageRequestID identifier that are returned by asynchronous requests.


Options for fitting an image’s aspect ratio to a requested size, used by the requestImage(for:targetSize:contentMode:options:resultHandler:) method.

Image Result Info Keys

Keys identifying information about an image loading result, used in the resultHandler block with the requestImage(for:targetSize:contentMode:options:resultHandler:) method.


Inherits From

Conforms To