<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 10.13.0 -",
    "tvOS: 11.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVDepthData/replacingDepthDataMap(with:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVDepthData(im)depthDataByReplacingDepthDataMapWithPixelBuffer:error:"
  },
  "title" : "replacingDepthDataMap(with:)"
}
-->

# replacingDepthDataMap(with:)

Returns a derivative depth data object by replacing the depth data map.

```
func replacingDepthDataMap(with pixelBuffer: CVPixelBuffer) throws -> Self
```

## Parameters

`pixelBuffer`

A pixel buffer containing depth or disparity information in a compatible format.

## Return Value

A new depth data object containing the pixel buffer.

## Discussion

If you apply simple transforms to media containing depth data, you can use the [`applyingExifOrientation(_:)`](/documentation/AVFoundation/AVDepthData/applyingExifOrientation(_:)) method to apply parallel transforms to the corresponding depth data. More complex transforms and edits require creating a derivative depth map reflecting whatever edits you make to the corresponding image. In such cases, use this [`replacingDepthDataMap(with:)`](/documentation/AVFoundation/AVDepthData/replacingDepthDataMap(with:)) method to create a derivative depth data object.

> Note:
> This method cannot ensure correspondence between an arbitrarily edited depth map and the camera parameters that generated the initial depth map, so the new depth data object’s ``doc://com.apple.avfoundation/documentation/AVFoundation/AVDepthData/cameraCalibrationData`` property is always `nil`.

---

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)