PHImageManager
An object that facilitates retrieving or generating preview thumbnails and asset data.
Declaration
class PHImageManagerMentioned in
Overview
Use these methods to fetch full-size photo assets or thumbnail images, or to retrieve AVFoundation objects for playing, exporting, and manipulating video assets.
To load image or video data:
Use the PHAsset class to fetch the asset you’re interested in.
Call the default() method to retrieve the shared image manager object.
Use one of the methods listed in the Requesting groups below 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.
Topics
Getting the Image Manager
Requesting Images
requestImage(for:targetSize:contentMode:options:resultHandler:)requestImageDataAndOrientation(for:options:resultHandler:)PHImageManagerMaximumSize
Requesting Video Objects
requestPlayerItem(forVideo:options:resultHandler:)requestExportSession(forVideo:options:exportPreset:resultHandler:)requestAVAsset(forVideo:options:resultHandler:)