---
title: PHLivePhotoEditingContext
framework: photos
role: symbol
role_heading: Class
path: photos/phlivephotoeditingcontext
---

# PHLivePhotoEditingContext

An editing session for modifying the photo, video, and audio content of a Live Photo.

## Declaration

```swift
class PHLivePhotoEditingContext
```

## Mentioned in

Editing Asset Content

## Overview

Overview A Live Photo is a picture, captured by a supported iOS device, that includes motion and sound from the moments just before and after it was taken. Editing the content of a Live Photo works much like editing other asset types: In an app using the Photos framework, fetch a PHAsset object that represents the Live Photo to edit, and use that object’s requestContentEditingInput(with:completionHandler:) method to retrieve a PHContentEditingInput object. In a photo editing extension that runs within the Photos app, your extension’s main view controller (which adopts the PHContentEditingController protocol) receives a PHContentEditingInput object when the user chooses to edit a Live Photo with your extension. 2. Create a Live Photo editing context with the init(livePhotoEditingInput:) initializer. You can create a Live Photo editing context only from PHContentEditingInput object that represents a Live Photo. Use the livePhoto property of the editing input to verify that it has live Photo content. 3. Use the frameProcessor property to define a block to be used in processing the Live Photo’s visual content. Photos will call this block repeatedly to process each frame of the Live Photo’s video and still photo content. 4. Create a PHContentEditingOutput object to store the results of your edit, then call the saveLivePhoto(to:options:completionHandler:) to process the Live Photo and save it to your editing output object. This method applies your frameProcessor to each frame. note: You can also use the prepareLivePhotoForPlayback(withTargetSize:options:completionHandler:) method to process a preview-quality version of the Live Photo to display in your app’s UI during editing. To allow a user to continue working with the edit later (for example, to adjust the parameters of a filter), create a PHAdjustmentData object describing your changes, and store it in the adjustmentData property of your editing output. In an app using the Photos framework, use a photo library change block to commit the edit. (For details, see PHPhotoLibrary.) In the block, create a PHAssetChangeRequest object and set its contentEditingOutput property to the editing output that you created. In a photo editing extension, provide the PHContentEditingOutput object that you created in your main view controller’s finishContentEditing(completionHandler:) method. When you use either of the methods listed in Processing an Editing Context’s Live Photo, Photos calls your frameProcessor block repeatedly to process each frame of the Live Photo’s video and still photo content. In that block, a PHLivePhotoFrame object provides the Live Photo’s existing content as a CIImage object. You use Core Image to modify the image, then provide the result of your edits by returning a CIImage object representing the result of processing the input image. tip: Core Image provides several ways to process the Live Photo’s visual content. You can use the built-in filters listed in Core Image Filter Reference or create CIFilter subclasses using custom graphics kernel code. Or, to use other image processing technologies, you can directly access and modify image content in pixel buffers, Metal textures, or IOSurfaceRef objects with a custom CIImageProcessorKernel subclass.

## Topics

### Creating a Live Photo Editing Context

- [init(livePhotoEditingInput:)](photos/phlivephotoeditingcontext/init(livephotoeditinginput:).md)

### Preparing an Editing Context for Processing

- [frameProcessor](photos/phlivephotoeditingcontext/frameprocessor.md)
- [PHLivePhotoFrameProcessingBlock](photos/phlivephotoframeprocessingblock.md)
- [audioVolume](photos/phlivephotoeditingcontext/audiovolume.md)

### Processing an Editing Context’s Live Photo

- [saveLivePhoto(to:options:completionHandler:)](photos/phlivephotoeditingcontext/savelivephoto(to:options:completionhandler:).md)
- [prepareLivePhotoForPlayback(withTargetSize:options:completionHandler:)](photos/phlivephotoeditingcontext/preparelivephotoforplayback(withtargetsize:options:completionhandler:).md)
- [PHLivePhotoEditingOption](photos/phlivephotoeditingoption.md)
- [cancel()](photos/phlivephotoeditingcontext/cancel().md)

### Examining an Editing Context’s Live Photo

- [fullSizeImage](photos/phlivephotoeditingcontext/fullsizeimage.md)
- [duration](photos/phlivephotoeditingcontext/duration.md)
- [photoTime](photos/phlivephotoeditingcontext/phototime.md)
- [orientation](photos/phlivephotoeditingcontext/orientation.md)

### Errors

- [PHLivePhotoEditingErrorDomain](photos/phlivephotoeditingerrordomain.md)
- [PHLivePhotoEditingErrorCode](photos/phlivephotoeditingerrorcode.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Editing an Asset

- [Editing Asset Content](photokit/editing-asset-content.md)
- [PHContentEditingInput](photos/phcontenteditinginput.md)
- [PHContentEditingOutput](photos/phcontenteditingoutput.md)
- [PHAdjustmentData](photos/phadjustmentdata.md)
- [PHContentEditingInputRequestOptions](photos/phcontenteditinginputrequestoptions.md)
- [PHLivePhotoFrame](photos/phlivephotoframe.md)
- [canPerform(_:)](photos/phasset/canperform(_:).md)
- [PHAssetEditOperation](photos/phasseteditoperation.md)
- [requestContentEditingInput(with:completionHandler:)](photos/phasset/requestcontenteditinginput(with:completionhandler:).md)
- [cancelContentEditingInputRequest(_:)](photos/phasset/cancelcontenteditinginputrequest(_:).md)
- [PHContentEditingInputRequestID](photos/phcontenteditinginputrequestid.md)
- [Editing Request Info Keys](photokit/editing-request-info-keys.md)
