Protocol

PHProjectExtensionController

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

Declaration

protocol PHProjectExtensionController

Overview

The principal view controller for a Photos project extension must conform to this protocol. Methods in this protocol define the basic life cycle of the extension controller. They allow you to define any number of project types that your extension supports; the Photos app displays these project types to the user as choices when creating a new project. To enable this entry point into the extension, the Info.plist must include this key/value pair in its NSExtensionAttributes dictionary.

Screenshot showing the slideshow category in the information property list for a Photos project extension.

Once enabled, Photos asks the extension for its list of supported project types. The option that the user selects when creating a project is passed to the extension as an attribute of PHProjectInfo.

Topics

Tracking the Project Extension Life Cycle

func beginProject(with: PHProjectExtensionContext, projectInfo: PHProjectInfo, completion: (Error?) -> Void)

Provides an opportunity to customize the initial state when the user creates a project using the extension.

Required.

func finishProject(completionHandler: () -> Void)

Provides an opportunity to perform cleanup when a user switches away from the project or terminates the extension.

Required.

func resumeProject(with: PHProjectExtensionContext, completion: (Error?) -> Void)

Provides an opportunity to restore or refresh the user interface when the user returns to a previously created project.

Required.

func typeDescriptionDataSource(for: PHProjectCategory, invalidator: PHProjectTypeDescriptionInvalidator) -> PHProjectTypeDescriptionDataSource

Fetches the type description data source to provide the user with more information about the project extension category.

Defining Supported Project Types

var supportedProjectTypes: [PHProjectTypeDescription]

An array of project types the extension supports.

Deprecated

Relationships

Inherits From

See Also

macOS Photos Project Extensions

Creating a Slideshow Project Extension for Photos

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

class PHProject

A representation of a Photos app project extension.

class PHProjectInfo

Information about the project extension.

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

class PHProjectElement

The superclass for all element objects.

class PHProjectSection

A collection of content representing curated asset and text elements.

class PHProjectRegionOfInterest

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

class PHProjectChangeRequest

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

class PHCloudIdentifier

A cloud identifier for a Photos project extension.

struct PHProjectCategory

A representation of Photos project extension categories.