<!--
{
  "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/scaledToFill()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE12scaledToFillQryF"
  },
  "title" : "scaledToFill()"
}
-->

# scaledToFill()

Scales this view to fill its parent.

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

## Return Value

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

## Discussion

Use `scaledToFill()` to scale this view to fill its parent, while
maintaining the view’s aspect ratio as the view scales:

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

![A screenshot of pink circle scaled to fill its](images/com.apple.SwiftUI/SwiftUI-View-scaledToFill-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.fill`](/documentation/SwiftUI/ContentMode/fill).

---

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)