---
title: fixedSize()
framework: swiftui
role: symbol
role_heading: Instance Method
path: swiftui/view/fixedsize()
---

# fixedSize()

Fixes this view at its ideal size.

## Declaration

```swift
nonisolated func fixedSize() -> some View

```

## Return Value

Return Value A view that fixes this view at its ideal size.

## Discussion

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 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)

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.

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:).

## See Also

### Influencing a view’s size

- [frame(width:height:alignment:)](swiftui/view/frame(width:height:alignment:).md)
- [frame(depth:alignment:)](swiftui/view/frame(depth:alignment:).md)
- [frame(minWidth:idealWidth:maxWidth:minHeight:idealHeight:maxHeight:alignment:)](swiftui/view/frame(minwidth:idealwidth:maxwidth:minheight:idealheight:maxheight:alignment:).md)
- [frame(minDepth:idealDepth:maxDepth:alignment:)](swiftui/view/frame(mindepth:idealdepth:maxdepth:alignment:).md)
- [containerRelativeFrame(_:alignment:)](swiftui/view/containerrelativeframe(_:alignment:).md)
- [containerRelativeFrame(_:alignment:_:)](swiftui/view/containerrelativeframe(_:alignment:_:).md)
- [containerRelativeFrame(_:count:span:spacing:alignment:)](swiftui/view/containerrelativeframe(_:count:span:spacing:alignment:).md)
- [fixedSize(horizontal:vertical:)](swiftui/view/fixedsize(horizontal:vertical:).md)
- [layoutPriority(_:)](swiftui/view/layoutpriority(_:).md)
