An environment-dependent font.


@frozen struct Font


The system resolves a font’s value at the time it uses the font in a given environment because Font is a late-binding token.


Getting Standard Fonts

static let largeTitle: Font

A font with the large title text style.

static let title: Font

A font with the title text style.

static var headline: Font

A font with the headline text style.

static var subheadline: Font

A font with the subheadline text style.

static var body: Font

A font with the body text style.

static var callout: Font

A font with the callout text style.

static var caption: Font

A font with the caption text style.

static var footnote: Font

A font with the footnote text style.

Getting System Fonts


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 system(size: CGFloat, weight: Font.Weight, design: Font.Design) -> Font

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

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.

Styling a Font

func bold() -> Font

Adds bold styling to the font.

func italic() -> Font

Adds italics to the font.

func monospacedDigit() -> Font

Adjusts the font to use monospace digits.

func smallCaps() -> Font

Adjusts the font to enable all small capitals.

func lowercaseSmallCaps() -> Font

Adjusts the font to enable lowercase small capitals.

func uppercaseSmallCaps() -> Font

Adjusts the font to enable uppercase small capitals.

func weight(Font.Weight) -> Font

Sets the weight of the font.

struct Font.Weight

A weight to use for fonts.


Conforms To

See Also


struct Text

A view that displays one or more lines of read-only text.

struct TextField

A control that displays an editable text interface.

struct SecureField

A control into which the user securely enters private text.