---
title: "replacementDepthData(for:)"
framework: avfoundation
role: symbol
role_heading: Instance Method
path: "avfoundation/avcapturephotofiledatarepresentationcustomizer/replacementdepthdata(for:)"
---

# replacementDepthData(for:)

A callback in which you can provide replacement depth data or strip existing depth data from the file.

## Declaration

```swift
optional func replacementDepthData(for photo: AVCapturePhoto) -> AVDepthData?
```

## Parameters

- `photo`: The calling instance of doc://com.apple.avfoundation/documentation/AVFoundation/AVCapturePhoto whose file metadata you’re modifying.

## Return Value

Return Value An instance of AVDepthData.  To preserve the existing depth data, return photo.depthData. To strip existing depth data, provide a replacement AVDepthData instance.

## Discussion

Discussion This callback is optional. If your delegate doesn’t implement this callback, the existing metadata in the in-memory AVCapturePhoto container is written directly to the file data representation.

## See Also

### Replacing or removing metadata

- [replacementMetadata(for:)](avfoundation/avcapturephotofiledatarepresentationcustomizer/replacementmetadata(for:).md)
- [replacementEmbeddedThumbnailPixelBuffer(withPhotoFormat:for:)](avfoundation/avcapturephotofiledatarepresentationcustomizer/replacementembeddedthumbnailpixelbuffer(withphotoformat:for:).md)
- [replacementPortraitEffectsMatte(for:)](avfoundation/avcapturephotofiledatarepresentationcustomizer/replacementportraiteffectsmatte(for:).md)
- [replacementSemanticSegmentationMatte(ofType:for:)](avfoundation/avcapturephotofiledatarepresentationcustomizer/replacementsemanticsegmentationmatte(oftype:for:).md)
- [replacementAppleProRAWCompressionSettings(for:defaultSettings:maximumBitDepth:)](avfoundation/avcapturephotofiledatarepresentationcustomizer/replacementappleprorawcompressionsettings(for:defaultsettings:maximumbitdepth:).md)
