Fetching Objects and Requesting Changes

Get assets, asset collections, and collection lists matching a specified query.


Instances of the model classes PHAsset, PHAssetCollection, and PHCollectionList represent the items a user works with in the Photos app:

  • Assets: Images, videos, and Live Photos

  • Collections of assets: Albums or Moments

  • Lists of collections: Album folders or Moment clusters

Instances of these classes are read-only and immutable, and contain only metadata. Use these classes to fetch a set of objects matching a specified query.

Commit Change Requests to the Shared Photo Library

Fetch assets and collections you’re interested in, and use those objects to fetch the raw data you need to reference or edit. To make changes, create change request objects and explicitly commit them to the shared PHPhotoLibrary object. This architecture makes it easy, safe, and efficient to work with the same assets from multiple threads or multiple apps and app extensions.

Handle Special Assets

PhotoKit supports a number of Photos app features for working directly with a user’s Photos library. For example, Live Photos are special assets with additional data that your app can display differently, as a video or sequence of frames.

Use the PHCollectionList class to find assets corresponding to the Moments hierarchy in the Photos App. Lists of collections are read-only, immutable, and contain only metadata. Use the PHAsset class to identify burst photos, Live Photos, panoramic photos, and high-frame-rate videos. When iCloud Photos is enabled, assets and collections in the Photos framework reflect content available across all devices on the same iCloud account.

For more information about Live Photos, see Displaying Live Photos.

See Also

Asset Retrieval

class PHAsset

A representation of an image, video, or Live Photo in the Photos library.

class PHAssetCollection

A representation of a Photos asset grouping, such as a moment, user-created album, or smart album.

class PHCollection

The abstract superclass for Photos asset collections and collection lists.

class PHCollectionList

A group containing Photos asset collections, such as Moments, Years, or folders of user-created albums.

class PHObject

The abstract superclass for Photos model objects (assets and collections).

class PHFetchResult

An ordered list of assets or collections returned from a Photos fetch method.

class PHFetchOptions

A set of options that affect the filtering, sorting, and management of results that Photos returns when you fetch asset or collection objects.