---
title: "AVMakeRect(aspectRatio:insideRect:)"
framework: avfoundation
role: symbol
role_heading: Function
path: "avfoundation/avmakerect(aspectratio:insiderect:)"
---

# AVMakeRect(aspectRatio:insideRect:)

Returns a scaled rectangle that maintains the specified aspect ratio within a bounding rectangle.

## Declaration

```swift
func AVMakeRect(aspectRatio: CGSize, insideRect boundingRect: CGRect) -> CGRect
```

## Parameters

- `aspectRatio`: The width and height ratio (aspect ratio) you want to maintain.
- `boundingRect`: The bounding rectangle you want to fit into.

## Return Value

Return Value Returns a scaled CGRect that maintains the aspect ratio specified by aspectRatio that fits within boundingRect.

## Discussion

Discussion Use this function when attempting to fit the presentation size of a player item object’s content within the bounds of another CALayer. Use the returned CGRect as the player layer’s frame property value. For example:
