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

# fixedSize()

Fixes this view at its ideal size.

```
@export(implementation) nonisolated func fixedSize() -> some View
```

## Return Value

A view that fixes this view at its ideal size.

## Discussion

During the layout of the view hierarchy, each view proposes a size to
each child view it contains. If the child view doesn’t need a fixed size
it can accept and conform to the size offered by the parent.

For example, a [`Text`](/documentation/SwiftUI/Text) view placed in an explicitly sized frame wraps
and truncates its string to remain within its parent’s bounds:

```
Text("A single line of text, too long to fit in a box.")
    .frame(width: 200, height: 200)
    .border(Color.gray)
```

![A screenshot showing the text in a text view contained within its](images/com.apple.SwiftUI/SwiftUI-View-fixedSize-1@2x.png)

The `fixedSize()` modifier can be used to create a view that maintains
the *ideal size* of its children both dimensions:

```
Text("A single line of text, too long to fit in a box.")
    .fixedSize()
    .frame(width: 200, height: 200)
    .border(Color.gray)
```

This can result in the view exceeding the parent’s bounds, which may or
may not be the effect you want.

![A screenshot showing a text view exceeding the bounds of its](images/com.apple.SwiftUI/SwiftUI-View-fixedSize-2@2x.png)

You can think of `fixedSize()` as the creation of a *counter proposal*
to the view size proposed to a view by its parent. The ideal size of a
view, and the specific effects of `fixedSize()` depends on the
particular view and how you have configured it.

To create a view that fixes the view’s size in either the horizontal or
vertical dimensions, see [`fixedSize(horizontal:vertical:)`](/documentation/SwiftUI/View/fixedSize(horizontal:vertical:)).

---

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)