---
title: "transformedMetadataObject(for:)"
framework: avfoundation
role: symbol
role_heading: Instance Method
path: "avfoundation/avcapturevideopreviewlayer/transformedmetadataobject(for:)"
---

# transformedMetadataObject(for:)

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

## Declaration

```swift
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 doc://com.apple.avfoundation/documentation/AVFoundation/AVCaptureInput as the preview layer.

## Return Value

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

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 and rollAngle values with respect to an unrotated picture. The conversion takes orientation, mirroring, layer bounds and video gravity into consideration.

## See Also

### Converting between coordinate spaces

- [layerPointConverted(fromCaptureDevicePoint:)](avfoundation/avcapturevideopreviewlayer/layerpointconverted(fromcapturedevicepoint:).md)
- [captureDevicePointConverted(fromLayerPoint:)](avfoundation/avcapturevideopreviewlayer/capturedevicepointconverted(fromlayerpoint:).md)
- [layerRectConverted(fromMetadataOutputRect:)](avfoundation/avcapturevideopreviewlayer/layerrectconverted(frommetadataoutputrect:).md)
- [metadataOutputRectConverted(fromLayerRect:)](avfoundation/avcapturevideopreviewlayer/metadataoutputrectconverted(fromlayerrect:).md)
