Reference

PHAssetResource

PHAssetResource describes the underlying files that back a PHAsset, such as the full-size photo, an edited version, an adjustment sidecar, or a paired video for a Live Photo. It is how iOS apps inspect resource types and read original file data.

iOS developmentiOSiPadOS

PHAssetResource

Also known as: phassetresource ios, photo resource size, ios phassetresource

PHAssetResource describes the underlying files that back a PHAsset, such as the full-size photo, an edited version, an adjustment sidecar, or a paired video for a Live Photo. It is how iOS apps inspect resource types and read original file data.

  • One PHAsset can have multiple resources: original photo, edited version, adjustment data, and a paired Live Photo video.
  • PHAssetResourceType identifies each resource (.photo, .video, .fullSizePhoto, .pairedVideo, .adjustmentData).
  • Read true bytes via PHAssetResourceManager.requestData; set isNetworkAccessAllowed for iCloud-stored originals.

What a PHAssetResource represents

A single PHAsset can map to several files on disk. PHAssetResource.assetResources(for:) returns the list, each with a PHAssetResourceType such as .photo, .video, .fullSizePhoto, .adjustmentData, or .pairedVideo for Live Photos. This is the accurate way to learn what actually occupies storage behind one library item.

For example, an edited photo keeps both the original and the edited render plus an adjustment file. A Live Photo carries a still image and a paired video. Counting only the visible thumbnail would badly understate true space usage.

Reading sizes and bytes

Each resource exposes an originalFilename and a uniformTypeIdentifier. There is no public size property directly, but the private fileSize value is available via key-value access, and you can read the actual bytes with PHAssetResourceManager.default().requestData(for:options:dataReceivedHandler:completionHandler:) to sum them precisely.

Set isNetworkAccessAllowed = true in PHAssetResourceRequestOptions when originals live in iCloud Photos. To write a resource to a temporary file, use writeData(for:toFile:options:completionHandler:) — useful when computing a hash for duplicate detection.

Related terms

Keep reading the reference.

Act on it

Guides and tools for this topic.