If the user has Bold Text enabled, it will just work if you are using fonts based on text styles. If you have your own styles, or you are using a non-system font, you'll need to provide the bolder version of the font when the setting is on.

Some code shows how a single line is all you need for it to work with both Dynamic Type and Bold Text if you use preferred fonts for one of the pre-defined text styles. If you try to load a custom font, like Comic Sans, you then need to check if isBoldTextEnabled is true, and in that case, you need to load the bold version of the font. You can then retrieve the scaled font from UIFontMetrics, to have a similar behaviour to the system font, with the custom font.

You may also find interesting...

In iOS' Settings you can specify your preference to use bold text. This can be checked in code in a couple ways: 1. isBoldTextEnabled in UIAccessibility: https://developer.apple.com/documentation/uikit/uiaccessibility/isboldtextenabled 2. legibilityWeight from UITraitCollection: https://developer.apple.com/documentation/uikit/uitraitcollection/legibilityweight

A common example where you need to manually configure the button accessibility trait is for some table/collection view cells. These tend to be “buttons” that perform an action, like playing music, or bring the user to a different screen.

Since iOS 14, you can get a human readable localised name for a UIColor, with a very useful property called accessibilityName, that you can use in accessibility attributes like labels or values. How cool is that? https://developer.apple.com/documentation/uikit/uicolor/accessibilityname

Created in Swift with Ignite.

Supporting Swift for Swifts