PhotoKit

Work with image and video assets managed by the Photos app, including those from iCloud Photos and Live Photos.

Overview

In iOS and macOS, PhotoKit provides classes that support building photo-editing extensions for the Photos app. In iOS and tvOS, PhotoKit also provides direct access to the photo and video assets managed by the Photos app.

A diagram showing the types of requests your app can make through PhotoKit, to access photos stored in the user's photo library

Using PhotoKit, you can fetch and cache assets for display and playback, edit image and video content, or manage collections of assets such as albums, Moments, and Shared Albums.

Topics

Shared Photo Library

Browsing and Modifying Photo Albums

Help users organize their photos into albums and browse photo collections in a grid-based layout using PhotoKit.

Requesting Authorization to Access Photos

Prepare your app to ask for permission when accessing the user's photo library.

PHPhotoLibrary

A shared object that manages access and changes to the user’s shared photo library.

Asset Retrieval

Fetching Objects and Requesting Changes

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

PHAsset

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

PHAssetCollection

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

PHCollection

The abstract superclass for Photos asset collections and collection lists.

PHCollectionList

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

PHObject

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

PHFetchResult

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

PHFetchOptions

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

Asset Loading

Loading and Caching Assets and Thumbnails

Request image, video, or Live Photos content, and cache for quick reuse.

PHImageManager

An object that facilitates retrieving or generating preview thumbnails and asset data.

PHCachingImageManager

An object that facilitates retrieving or generating preview thumbnails, optimized for batch preloading large numbers of assets.

PHImageRequestOptions

A set of options affecting the delivery of still image representations of Photos assets you request from an image manager.

PHVideoRequestOptions

A set of options affecting the delivery of video asset data that you request from an image manager.

PHLivePhotoRequestOptions

A set of options affecting the delivery of Live Photo assets you request from an image manager.

Live Photos

Displaying Live Photos

Provide the same interactive playback of Live Photos as in the iOS Photos app.

PHLivePhotoView

A view that displays a Live Photo—a picture that also includes motion and sound from the moments just before and after its capture.

PHLivePhoto

A displayable representation of a Live Photo—a picture that includes motion and sound from the moments just before and after its capture.

Asset Resource Management

PHAssetResource

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

PHAssetCreationRequest

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

PHAssetResourceCreationOptions

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

PHAssetResourceManager

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

PHAssetResourceRequestOptions

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

Photo Editing Extensions

Creating Photo Editing Extensions

Allow your app to edit assets directly within the Photos app.

PHContentEditingController

A protocol your custom view controller class implements to provide a user interface for your Photos extension.

PHEditingExtensionContext

An object that provides Photos editing extensions with access to the underlying project and photo library.

Deprecated

macOS Photos Project Extensions

Creating a Slideshow Project Extension for Photos

Augment the macOS Photos app with extensions that support project creation.

PHProject

A representation of a Photos app project extension.

PHProjectInfo

Information about the project extension.

PHProjectExtensionContext

An object that provides Photos project extensions with access to the underlying project, as well as to the user's photo library for editing.

PHProjectElement

The superclass for all element objects.

PHProjectSection

A collection of content representing curated asset and text elements.

PHProjectRegionOfInterest

A representation of a region of interest in a photo asset.

PHProjectChangeRequest

A request to change asset data in a Photos project extension.

PHProjectExtensionController

A protocol defining the life cycle and supported types of project extensions.

PHCloudIdentifier

A cloud identifier for a Photos project extension.

PHProjectCategory

A representation of Photos project extension categories.