Font

An environment-dependent font.

StructureiOS 13.0+macOS 10.15+tvOS 13.0+watchOS 6.0+Font in SwiftUI

Declaration

React
type Font =
  | 'body'
  | 'callout'
  | 'caption'
  | 'caption2'
  | 'default'
  | 'footnote'
  | 'headline'
  | 'largeTitle'
  | 'subheadline'
  | 'title'
  | 'title2'
  | 'title3'
  | { custom: { name: string; fixedSize: number; }; }
  | { custom: { name: string; size: number; }; }
  | { custom: { name: string; size: number; relativeTo: FontTextStyle; }; }
  | { system: { size: number; weight?: FontWeight | null; design?: FontDesign | null; }; }
  | { system: { style: FontTextStyle; design?: FontDesign | null; weight?: FontWeight | null; }; }
  | FontChain;
Swift
@frozen struct Font

Pass a literal, or build one with SwiftUI.Font from import { SwiftUI } from 'swiftui-react-native'.

Type properties

  • 'body'SwiftUI.Font.body

    A font with the body text style.

  • 'callout'SwiftUI.Font.callout

    A font with the callout text style.

  • 'caption'SwiftUI.Font.caption

    A font with the caption text style.

  • 'caption2'SwiftUI.Font.caption2

    Create a font with the alternate caption text style.

  • 'default'SwiftUI.Font.default

    The effective SwiftUI font used in any given environment.

  • 'footnote'SwiftUI.Font.footnote

    A font with the footnote text style.

  • 'headline'SwiftUI.Font.headline

    A font with the headline text style.

  • 'largeTitle'SwiftUI.Font.largeTitle

    A font with the large title text style.

  • 'subheadline'SwiftUI.Font.subheadline

    A font with the subheadline text style.

  • 'title'SwiftUI.Font.title

    A font with the title text style.

  • 'title2'SwiftUI.Font.title2

    Create a font for second level hierarchical headings.

  • 'title3'SwiftUI.Font.title3

    Create a font for third level hierarchical headings.

Type methods

Overview

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.

From Apple’s SwiftUI documentation. Code samples there are Swift.

Used by

See also

More in Text and symbols.