Contents

system(_:design:weight:)

Gets a system font that uses the specified style, design, and weight.

Declaration

static func system(_ style: Font.TextStyle, design: Font.Design? = nil, weight: Font.Weight? = nil) -> Font

Discussion

Use this method to create a system font that has the specified properties. The following example creates a system font with the Font.TextStyle.body text style, a Font.Design.serif design, and a bold weight, and applies the font to a Text view using the font(_:) view modifier:

Text("Hello").font(.system(.body, design: .serif, weight: .bold))

The design and weight parameters are both optional. If you omit either, the system uses a default value for that parameter. The default values are typically Font.Design.default and regular, respectively, but might vary depending on the context.

See Also

Getting system fonts