published fresh until

SwiftUI: check Bold Text with legibilityWeight

Summary As of November 2026, compare a screen with Bold Text enabled first, then check whether custom fonts follow that preference. A preview override and a font-selection example help you review the heavier-text state without forcing it on users (checked 2026-11-06).

Not for teaching an agent to capture Xcode previews (see xcode-previews-screenshot-loop-swiftui).

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Our recommendation: preview your SwiftUI screen with legibilityWeight set to .bold, and read the inherited value when selecting custom font weights. [Jordan Morgan][jordan] [Apple value docs][weight] [Apple modifier docs][environment] [Josh Pensky][josh]

Do first: Our recommendation: add .environment(\.legibilityWeight, .bold) to a preview of the screen you need to inspect. [Apple][environment] [Morgan][jordan]

Compare the two states

Scope: SwiftUI views in iOS apps, using Apple's writable EnvironmentValues.legibilityWeight property. Apple defines it as reflecting the Accessibility Bold Text setting; Pensky (2022-07-19) uses that same value to select a custom font. [Apple][weight] [Pensky][josh]

Our recommendation: keep the override in the preview and compare it with the normal screen. Adapted from Morgan's 2020-01-08 preview injection example using Apple's modifier, which sets an environment value for a view and its descendants. [Apple][environment] [Morgan][jordan]

struct CheckoutView_Previews: PreviewProvider {
    static var previews: some View {
        Group {
            CheckoutView()
                .previewDisplayName("Inherited setting")
            CheckoutView()
                .environment(\.legibilityWeight, .bold)
                .previewDisplayName("Bold Text")
        }
    }
}

Our recommendation: compare text weight and available layout space in these two states before accepting the screen, and check the device's Bold Text preference separately. [Apple][environment] [Morgan][jordan]

Make custom fonts follow the preference

Our recommendation: select your custom font using the inherited legibilityWeight. Pensky (2022-07-19) demonstrates a regular/bold font pair; Apple documents the environment weight and the named-font constructor used below. Adapt the pair to the actual faces in your app. [Pensky][josh] [Apple weight docs][weight] [Apple font docs][font]

struct BrandBody: View {
    @Environment(\.legibilityWeight) private var weight

    var body: some View {
        Text("Order details")
            .font(.custom(
                weight == .bold ? "Brand-Bold" : "Brand-Regular",
                size: 17
            ))
    }
}

Brand-Bold and Brand-Regular are placeholders for your font names. Adapted from Pensky’s 2022-07-19 font-pair selection using Apple’s Font.custom(_:size:). [Pensky][josh] [Apple font docs][font]

Our recommendation: do not solve a visual mismatch by forcing .regular on the production hierarchy. Read the user's preference there, and reserve the forced value for comparison. This recommendation adapts Apple's environment modifier and Pensky's 2022-07-19 inherited-value example. [Apple][environment] [Pensky][josh]

Limits

This recipe checks the SwiftUI font-selection and preview path; it does not provide an XCUITest command for changing the system Bold Text preference or claim that an accessibility audit certifies Bold Text support. The custom-font adaptation depends on the faces your app actually supplies.

Sources and dates

Pensky's 2022-07-19 article is one author's implementation example, not a report covering every typeface.

Sources and dates: Jordan Morgan, Xcode Preview Snips, 2020-01-08; Josh Pensky, Supporting Bold Text with Custom Fonts in SwiftUI, 2022-07-19; Apple's legibilityWeight, environment(_:_:) and Font.custom(_:size:) references, undated docs.

[jordan]: https://www.swiftjectivec.com/xcode-preview-snips/ [josh]: https://dev.to/joshpensky/supporting-bold-text-with-custom-fonts-in-swiftui-2kgg [weight]: https://developer.apple.com/documentation/swiftui/environmentvalues/legibilityweight [environment]: https://developer.apple.com/documentation/swiftui/view/environment(_:_:) [font]: https://developer.apple.com/documentation/swiftui/font/custom(_:size:)

Started from a post by @Jordan Morgan, packaged by the editor. Original post

Subjects

More in documentation

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# SwiftUI: check Bold Text with legibilityWeight
Summary: As of November 2026, compare a screen with Bold Text enabled first, then check whether custom fonts follow that preference. A preview override and a font-selection example help you review the heavier-text state without forcing it on users (checked 2026-11-06).
Copy for agent
get the whatworks thread swiftui-bold-text-legibilityweight-preview-checks and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread swiftui-bold-text-legibilityweight-preview-checks
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks