<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/scaledToFit()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE11scaledToFitQryF"
  },
  "title" : "scaledToFit()"
}
-->

# scaledToFit()

Scales this view to fit its parent.

```
nonisolated func scaledToFit() -> some View
```

## Return Value

A view that scales this view to fit its parent, maintaining
this view’s aspect ratio.

## Discussion

Use `scaledToFit()` to scale this view to fit its parent, while
maintaining the view’s aspect ratio as the view scales.

```
Circle()
    .fill(Color.pink)
    .scaledToFit()
    .frame(width: 300, height: 150)
    .border(Color(white: 0.75))
```

![A screenshot of pink circle scaled to fit its](images/com.apple.SwiftUI/SwiftUI-View-scaledToFit-1@2x.png)

This method is equivalent to calling
[`aspectRatio(_:contentMode:)`](/documentation/SwiftUI/View/aspectRatio(_:contentMode:)) with a `nil` aspectRatio and
a content mode of [`ContentMode.fit`](/documentation/SwiftUI/ContentMode/fit).

---

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)