Declaration
compose().textVariant(preference: SwiftUI.TextVariantPreference)func textVariant<V>(
_ preference: V
) -> some View
where V : TextVariantPreferenceParameters
preference*SwiftUI.TextVariantPreference
Discussion
Certain types of text, such as Text(_:format:), can generate strings of
different size to better fit the available space. By default, all text uses the
widest available variant. Setting the variant to be
TextVariantPreference.sizeDependent allows the text to take the available
space into account when choosing what content to display.
See also
More in Text modifiers.
- accessibilityHeadingSets the accessibility level of this heading.
- accessibilityLabelAdds a label to the view that describes its contents.
- accessibilityTextContentTypeSets an accessibility text content type.
- baselineOffsetSets the vertical offset for the text relative to its baseline.
- boldApplies a bold font weight to the text.
- fontSets the default font for text in the view.
- fontDesignSets the font design of the text.
- fontWeightSets the font weight of the text.
- fontWidthSets the font width of the text.
- foregroundStyleSets the style of the text displayed by this view.
- italicApplies italics to the text.
- kerningSets the spacing, or kerning, between characters.