preferredFont(forTextStyle:)
Returns an instance of the system font for the specified text style with scaling for the user’s selected content size category.
Declaration
class func preferredFont(forTextStyle style: UIFont.TextStyle) -> UIFontParameters
- style:
The text style for which to return a font. See Textstyle for recognized values.
Mentioned in
Return Value
The system font associated with the specified text style.
Discussion
To create a styled font based on a custom font, use a UIFontMetrics object.
Because fonts are immutable, any element that adjusts for an updated content size category does not modify the font itself. Instead, the element replaces the assigned font with a new instance based on the original settings.