Reference

PhotoKit

PhotoKit is Apple's framework for reading and managing a user's Photos library on iOS and iPadOS. It exposes the library through the Photos and PhotosUI modules, letting an app fetch photos and videos, load image data, and request edits or deletions through a permission-gated, change-aware API.

iOS developmentiOSiPadOS

PhotoKit

Also known as: photokit ios, phphotolibrary

PhotoKit is Apple's framework for reading and managing a user's Photos library on iOS and iPadOS. It exposes the library through the Photos and PhotosUI modules, letting an app fetch photos and videos, load image data, and request edits or deletions through a permission-gated, change-aware API.

  • PhotoKit spans two modules: Photos (data) and PhotosUI (pickers and editing UI).
  • Deleting assets always shows a system confirmation alert that apps cannot suppress.
  • Since iOS 14, users can grant Limited Photo Access instead of full library access.

What PhotoKit is

PhotoKit is the modern API set for working with the system Photos library. Its core entry point is PHPhotoLibrary, the shared object that represents the on-device library and brokers all read and write access. Apps query content with PHFetchRequest and receive lazily-loaded collections of PHAsset objects (photos, videos, Live Photos), grouped into albums and moments via PHAssetCollection.

Image and video data is never loaded eagerly. Instead, an app asks PHImageManager for a thumbnail or full-resolution representation at a requested size, and the manager streams cached or freshly-decoded data back asynchronously. This keeps memory low even when scanning tens of thousands of items.

Permissions and change tracking

Access is gated by the NSPhotoLibraryUsageDescription entitlement and an authorization prompt. Since iOS 14, users can grant Limited Photo Access, exposing only a hand-picked subset of assets, so a correct app always checks `PHPhotoLibrary.authorizationStatus(for:)` and handles the limited case.

Any modification, such as deleting assets, must run inside a performChanges block on PHPhotoLibrary, and deletions trigger a system confirmation alert the app cannot bypass. Apps observe live edits by registering a PHPhotoLibraryChangeObserver, which fires whenever the library changes so cached results stay in sync.

Why a storage cleaner uses it

A cleaner like Cleanor relies on PhotoKit to enumerate the camera roll, pull low-cost thumbnails through PHImageManager for visual comparison, and read asset metadata (capture date, dimensions, media type) used to surface duplicate and similar photos.

When the user confirms a cleanup, the app batches the chosen PHAsset identifiers into a single performChanges deletion request. The removed items move to Recently Deleted rather than vanishing instantly, giving the user a 30-day safety window.

Related terms

Keep reading the reference.

Act on it

Guides and tools for this topic.