<!--
{
  "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/replacementMetadata(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(pl)AVCapturePhotoFileDataRepresentationCustomizer(im)replacementMetadataForPhoto:"
  },
  "title" : "replacementMetadata(for:)"
}
-->

# replacementMetadata(for:)

A callback in which you can provide replacement metadata or direct [`AVCapturePhoto`](/documentation/AVFoundation/AVCapturePhoto) to strip existing metadata from the flattened file.

```
optional func replacementMetadata(for photo: AVCapturePhoto) -> [String : Any]?
```

## Parameters

`photo`

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

## Return Value

A dictionary of keys and valyes from `CGImageProperties`. To preserve existing metadata, return `photo.metadata`. To strip existing metadata, return `nil`. To replace metadata, pass a replacement dictionary.

## 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)