View loaded when the user begins a project extension in macOS Photos

Viewed 107

Edit: I just needed to set the value for the key 'PHProjectExtensionDefinesProjectTypes' to 'NO'.

I am creating a project extension in the macOS Photos application. The Xcode project includes a file 'PhotoProjectViewController.swift' with the following functions conforming to PHProjectExtensionController:

var projectExtensionContext: PHProjectExtensionContext? {}
var supportedProjectTypes: [PHProjectTypeDescription] {}
func beginProject(with extensionContext: PHProjectExtensionContext, projectInfo: PHProjectInfo, completion: @escaping (Error?) -> Void) {}
func resumeProject(with extensionContext: PHProjectExtensionContext, completion: @escaping (Error?) -> Void) {}
func finishProject(completionHandler completion: @escaping () -> Void) {}

There is also a view named PhotoProjectViewController.xib.

Apple has no documentation for the new project extension API.

My question is: what view is loaded when the user starts the project extension? Anything I put into the xib does not appear. The viewDidLoad() is called, but not beginProject(). How do you get the user's photo selection and load it into say a collection view? There is very little to go off from Apple, and nothing else online about creating these extensions.

This is the PhotoProjectViewController.xib: XIB

When I run the extension in Photos.app by choosing a photo and starting the extension, this appears: Extension View

I would like to get the photos the user selected and load them into a collection view in the extension.

1 Answers

When you say nothing is showing up in the extension view do you mean not even the default string that is in the template? That is working for me. What kind of view are you putting into the PhotoProjectViewController.xib?

Related