Class

PHAssetResource

An underlying data resource associated with a photo, video, or Live Photo asset in the Photos library.

Declaration

class PHAssetResource : NSObject

Overview

Each PHAsset object references one or more resources. Use these objects to work with those resources directly, like when backing up or restoring assets.

  • A photo asset can contain both JPEG and RAW files representing the same photo.

  • A Live Photo asset contains both still photo and video resources.

  • An edited asset contains resources representing asset content before and after the edit, as well as a resource corresponding to the PHAdjustmentData object that describes the edit.

To work with the data contained in an asset resource, fetch it using the PHAssetResourceManager class.

Topics

Retrieving an Asset’s Data Resources

class func assetResources(for: PHAsset) -> [PHAssetResource]

Returns the list of data resources associated with an asset.

class func assetResources(for: PHLivePhoto) -> [PHAssetResource]

Returns the list of data resources associated with a Live Photo object.

Examining an Asset Resource

var type: PHAssetResourceType

The relationship of this asset resource to its owning asset.

enum PHAssetResourceType

Values identifying the relationship of an asset resource to its owning asset; used by the type property.

var assetLocalIdentifier: String

The unique identifier for the asset object this resource is associated with.

var uniformTypeIdentifier: String

The uniform type identifier for the asset resource’s image or video data.

var originalFilename: String

The original filename of the asset resource from when it was created or imported.

Relationships

Inherits From

Conforms To

See Also

Asset Resource Management

class PHAssetCreationRequest

A request to create a new Photos asset from underlying data resources, for use in a photo library change block.

class PHAssetResourceCreationOptions

A set of options affecting the creation of a new Photos asset from underlying resources.

class PHAssetResourceManager

A resource manager for the data storage underlying a Photos asset.

class PHAssetResourceRequestOptions

A set of options affecting the delivery of underlying asset data that you request from the asset resource manager.