---
title: "aspectRatio3D(_:contentMode:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/aspectratio3d(_:contentmode:)"
---

# aspectRatio3D(_:contentMode:)

Constrains this view’s dimensions to the specified 3D aspect ratio.

## Declaration

```swift
nonisolated func aspectRatio3D(_ aspectRatio: Size3D? = nil, contentMode: ContentMode) -> some View

```

## Parameters

- `aspectRatio`: The ratio of width to height to depth to use for the resulting view. If aspectRatio is nil, the resulting view maintains this view’s aspect ratio.
- `contentMode`: A flag indicating whether this view should fit or fill the parent context.

## Return Value

Return Value A view that constrains this view’s dimensions to aspectRatio, using contentMode as its scaling algorithm.

## Discussion

Discussion If this view is resizable, the resulting view will have aspectRatio as its aspect ratio. In this example, the Model3D has a 2 : 3 : 1 width to height to depth ratio, and scales to fit its frame: Model3D(named: "Sphere") { resolved in     let ratio3D = Size3D(width: 2, height: 3, depth: 1)     resolved         .resizable()         .aspectRatio3D(ratio3D, contentMode: .fit) } placeholder: {     ProgressView() } .frame(width: 200, height: 200) .frame(depth: 200) .border(Color(white: 0.75))

## See Also

### Scale

- [scaledToFill()](swiftui/view/scaledtofill().md)
- [scaledToFill3D()](swiftui/view/scaledtofill3d().md)
- [scaledToFit()](swiftui/view/scaledtofit().md)
- [scaledToFit3D()](swiftui/view/scaledtofit3d().md)
- [scaleEffect(_:anchor:)](swiftui/view/scaleeffect(_:anchor:).md)
- [scaleEffect(x:y:anchor:)](swiftui/view/scaleeffect(x:y:anchor:).md)
- [scaleEffect(x:y:z:anchor:)](swiftui/view/scaleeffect(x:y:z:anchor:).md)
- [imageScale(_:)](swiftui/view/imagescale(_:).md)
- [aspectRatio(_:contentMode:)](swiftui/view/aspectratio(_:contentmode:).md)
