<!--
{
  "availability" : [
    "iOS: 6.0.0 -",
    "iPadOS: 6.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 17.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVCaptureVideoPreviewLayer/transformedMetadataObject(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVCaptureVideoPreviewLayer(im)transformedMetadataObjectForMetadataObject:"
  },
  "title" : "transformedMetadataObject(for:)"
}
-->

# transformedMetadataObject(for:)

Converts a metadata object’s visual properties to layer coordinates.

```
func transformedMetadataObject(for metadataObject: AVMetadataObject) -> AVMetadataObject?
```

## Parameters

`metadataObject`

The metadata object whose visual properties you want to convert. The metadata object must originate from the same [`AVCaptureInput`](/documentation/AVFoundation/AVCaptureInput) as the preview layer.

## Return Value

A metadata object with coordinates converted into layer coordinates, or `nil` if the  metadata object originates from an input source other than that of the preview layer.

## Discussion

The system provides the metadata object’s bounds as a rectangle where `{0,0}` represents the top-left of the picture area, and `{1,1}` represents the bottom-right on an unrotated image. Face metadata objects also provide [`yawAngle`](/documentation/AVFoundation/AVMetadataFaceObject/yawAngle) and [`rollAngle`](/documentation/AVFoundation/AVMetadataFaceObject/rollAngle) values with respect to an unrotated picture.

The conversion takes orientation, mirroring, layer bounds and video gravity into consideration.

---

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)