Fixes this view at its ideal size.
- iOS 13.0+
- macOS 10.15+
- Mac Catalyst 13.0+
- tvOS 13.0+
- watchOS 6.0+
- Xcode 11.0+
A view that fixes this view at its ideal size.
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:
fixed modifier can be used to create a view that maintains the ideal size of its children both dimensions:
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
fixed 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
fixed 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