Skip to main content
Primer Checkout iOS SDK is currently in beta (v3.0.0-beta.1). The API is subject to change before the stable release.
TypographyOverrides lets you override the typography tokens used across Primer Checkout text styles. Pass it to a PrimerCheckoutTheme through the typography parameter. Every token is optional — any token you leave nil falls back to the internal default, and within a token any nil property falls back to its default value.
All tokens use the Inter font with their documented defaults. You only override the tokens and properties you want to change.

TypographyOverrides

@available(iOS 15.0, *)
public struct TypographyOverrides: Equatable {
  public let titleXlarge: TypographyStyle?
  public let titleLarge: TypographyStyle?
  public let bodyLarge: TypographyStyle?
  public let bodyMedium: TypographyStyle?
  public let bodySmall: TypographyStyle?

  public init(
    titleXlarge: TypographyStyle? = nil,
    titleLarge: TypographyStyle? = nil,
    bodyLarge: TypographyStyle? = nil,
    bodyMedium: TypographyStyle? = nil,
    bodySmall: TypographyStyle? = nil
  )
}
TokenTypeDefaultDescription
titleXlargeTypographyStyle?nilTitle extra large: Inter, -0.6 letter spacing, weight 550, size 24, line height 32. Used for sheet titles.
titleLargeTypographyStyle?nilTitle large: Inter, -0.2 letter spacing, weight 550, size 16, line height 20. Used for section headers.
bodyLargeTypographyStyle?nilBody large: Inter, -0.2 letter spacing, weight 400, size 16, line height 20. Used for input text and body copy.
bodyMediumTypographyStyle?nilBody medium: Inter, 0 letter spacing, weight 400, size 14, line height 20. Used for labels and descriptions.
bodySmallTypographyStyle?nilBody small: Inter, 0 letter spacing, weight 400, size 12, line height 16. Used for helper text and errors.

Preview

titleXlarge — The quick brown fox jumps over the lazy dog
titleLarge — The quick brown fox jumps over the lazy dog
bodyLarge — The quick brown fox jumps over the lazy dog
bodyMedium — The quick brown fox jumps over the lazy dog
bodySmall — The quick brown fox jumps over the lazy dog

TypographyStyle

A single typography style. All properties are optional — any nil property falls back to the token default.
@available(iOS 15.0, *)
public struct TypographyStyle: Equatable {
  public let font: String?
  public let letterSpacing: CGFloat?
  public let weight: Font.Weight?
  public let size: CGFloat?
  public let lineHeight: CGFloat?

  public init(
    font: String? = nil,
    letterSpacing: CGFloat? = nil,
    weight: Font.Weight? = nil,
    size: CGFloat? = nil,
    lineHeight: CGFloat? = nil
  )
}
TypographyStyle is nested inside TypographyOverrides, so refer to it as TypographyOverrides.TypographyStyle when you need the fully qualified name.
PropertyTypeDefaultDescription
fontString?nilCustom font family name (e.g., "Inter")
letterSpacingCGFloat?nilLetter spacing in points
weightFont.Weight?nilSwiftUI font weight (e.g., .regular, .semibold, .bold)
sizeCGFloat?nilFont size in points
lineHeightCGFloat?nilLine height in points

Override example

Override only the tokens and properties you need. Anything you omit keeps its default.
import SwiftUI
import PrimerSDK

let theme = PrimerCheckoutTheme(
  typography: TypographyOverrides(
    titleXlarge: .init(
      font: "Inter",
      weight: .bold,
      size: 28,
      lineHeight: 36
    ),
    bodyLarge: .init(
      letterSpacing: 0,
      size: 17
    ),
    bodySmall: .init(
      weight: .medium,
      size: 13
    )
  )
)
Pass the theme to your checkout the same way you pass any PrimerCheckoutTheme. See PrimerTheme for how to apply it.

See also

PrimerTheme

Assemble and apply a complete theme with all token overrides.

Color Tokens

Override the color tokens used across the checkout UI.

Spacing Tokens

Adjust spacing tokens for padding and layout.

Shape Tokens

Customize corner radius and border width tokens.