Type Method

system(size:weight:design:)

Specifies a system font to use, along with the style, weight, and any design parameters you want applied to the text.

Declaration

static func system(size: CGFloat, weight: Font.Weight = .regular, design: Font.Design = .default) -> Font

Discussion

Use this function to create a system font by specifying the size and weight, and a type design together. The following styles the system font as 17 point, semibold text:

Text("Hello").font(.system(size: 17, weight: .semibold))

While the following styles the text as 17 point bold, and applies a serif Font.Design to the system font:

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

If you want to use the default Font.Weight (regular), you don't need to specify the weight in the method. The following example styles the text as 17 point regular, and uses a Font.Design.rounded system font:

Text("Hello").font(.system(size: 17, design: .rounded))

See Also

Getting System Fonts

init(CTFont)

Gets a font from a platform font instance.

static func system(Font.TextStyle, design: Font.Design) -> Font

Gets a system font with the given style and design.

static func custom(String, size: CGFloat) -> Font

Gets a custom font with the given name and size.

enum Font.TextStyle

A dynamic text style to use for fonts.

enum Font.Design

A design to use for fonts.