Instance Method

finishContentEditing(completionHandler:)

Asks your extension for edited asset data to finish the editing session.

Required.

Declaration

func finishContentEditing(completionHandler: @escaping (PHContentEditingOutput?) -> Void)

Parameters

completionHandler

A block for your extension to call when you have finished editing.

The block takes the following parameter:

output

The PHContentEditingOutput object you created and populated before calling the completion handler.

Discussion

Photos calls this method when the user chooses to end the editing session. Your extension view controller should:

  1. Disable UI elements to prevent the user from editing further while you complete the remaining steps on a background queue.

  2. Create a PHContentEditingOutput object from the PHContentEditingInput object that Photos provided to your extension in the startContentEditing(with:placeholderImage:) method.

    Use the content editing output to store the rendered photo or video data from the user’s edits and a PHAdjustmentData object describing the edits.

  3. Call the completionHandler block with your content editing output, to notify Photos that the edit is complete.

  4. After the completionHandler block finishes executing, you may safely clean up any data or files related to your edit.

See Also

Performing an Edit

func startContentEditing(with: PHContentEditingInput, placeholderImage: UIImage)

Tells your extension that asset data is available for editing.

Required.