View Source ViewThatFits

<ViewThatFits>

Chooses the first child that fits in the available space.

Overview

Child elements are evaluated in order, and the first child that fits in the available space along axes is displayed.

<ViewThatFits>
    <Text>Long text content ... </Text>
    <Image systemName="doc.text" />
</ViewThatFits>

In the above example, if the text content is too large to fit on screen the icon will be displayed instead.

Attributes

SwiftUI Documentation

See SwiftUI.ViewThatFits for more details on this View.

References

The axes to check each child’s size along. Defaults to all.

Discussion

See Axis.Set