---
title: "layerRectConverted(fromMetadataOutputRect:)"
framework: avfoundation
role: symbol
role_heading: Instance Method
path: "avfoundation/avcapturevideopreviewlayer/layerrectconverted(frommetadataoutputrect:)"
---

# layerRectConverted(fromMetadataOutputRect:)

Converts a rectangle from metadata output coordinates to the coordinate space of the layer.

## Declaration

```swift
func layerRectConverted(fromMetadataOutputRect rectInMetadataOutputCoordinates: CGRect) -> CGRect
```

## Parameters

- `rectInMetadataOutputCoordinates`: A rectangle in the doc://com.apple.avfoundation/documentation/AVFoundation/AVCaptureMetadataOutput coordinate system.

## Return Value

Return Value A rectangle in the preview layer’s coordinate system.

## Discussion

Discussion A metadata capture output’s rectOfInterest a CGRect value where {0,0} represents the top-left of the picture area, and {1,1} represents the bottom-right on an unrotated image. The system takes the layer’s frame size and its videoGravity into consideration when making the conversion.

## See Also

### Converting between coordinate spaces

- [layerPointConverted(fromCaptureDevicePoint:)](avfoundation/avcapturevideopreviewlayer/layerpointconverted(fromcapturedevicepoint:).md)
- [captureDevicePointConverted(fromLayerPoint:)](avfoundation/avcapturevideopreviewlayer/capturedevicepointconverted(fromlayerpoint:).md)
- [metadataOutputRectConverted(fromLayerRect:)](avfoundation/avcapturevideopreviewlayer/metadataoutputrectconverted(fromlayerrect:).md)
- [transformedMetadataObject(for:)](avfoundation/avcapturevideopreviewlayer/transformedmetadataobject(for:).md)
