<!--
{
  "availability" : [
    "iOS: 12.0.0 -",
    "iPadOS: 12.0.0 -",
    "macCatalyst: 14.0.0 -",
    "tvOS: 17.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVCapturePhotoFileDataRepresentationCustomizer/replacementDepthData(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(pl)AVCapturePhotoFileDataRepresentationCustomizer(im)replacementDepthDataForPhoto:"
  },
  "title" : "replacementDepthData(for:)"
}
-->

# replacementDepthData(for:)

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

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

## Parameters

`photo`

The calling instance of [`AVCapturePhoto`](/documentation/AVFoundation/AVCapturePhoto) whose file metadata you’re modifying.

## Return Value

An instance of [`AVDepthData`](/documentation/AVFoundation/AVDepthData).  To preserve the existing depth data, return `photo.depthData`. To strip existing depth data, provide a replacement [`AVDepthData`](/documentation/AVFoundation/AVDepthData) instance.

## Discussion

This callback is optional. If your delegate doesn’t implement this callback, the existing metadata in the in-memory [`AVCapturePhoto`](/documentation/AVFoundation/AVCapturePhoto) container is written directly to the file data representation.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)