The abstract superclass for Photos asset collections and collection lists.


class PHCollection : PHObject


You do not create or work with instances of this class directly. Instead, use one of its two concrete subclasses, PHAssetCollection or PHCollectionList.

  • A PHAssetCollection object represents a collection of photo or video assets, such as an album, moment, or Shared Photo Stream.

  • A PHCollectionList object represents a collection that contains other collections, such as a a folder containing albums or the set of all moments in a calendar year.


Fetching Collections

class func fetchTopLevelUserCollections(with: PHFetchOptions?) -> PHFetchResult<PHCollection>

Retrieves collections from the root of the photo library’s hierarchy of user-created albums and folders.

Reading Collection Metadata

var localizedTitle: String?

The localized name of the collection.

Determining Collection Capabilities

var canContainAssets: Bool

A Boolean value indicating whether the collection can contain assets.

var canContainCollections: Bool

A Boolean value indicating whether the collection can contain other collections.

func canPerform(PHCollectionEditOperation) -> Bool

Returns whether the collection supports the specified editing operation.

enum PHCollectionEditOperation

Values identifying possible actions that a collection can support, used by the canPerform(_:) method.


Inherits From

Conforms To

See Also

Asset Retrieval

Fetching Objects and Requesting Changes

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

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 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.