24.7 · Adaptive colour, font fallback and mirrored drawing
Three places where the system adapts to the user and your code has to cooperate: colours that change with appearance and contrast, text in scripts your font does not contain, and layouts and images that mirror.
Mental model. Resolve colours against traits, never cache them; never name system fonts; and know which layout types mirror by themselves.
Adaptation
Dynamic colour, font cascade, mirrored layout and images.
- How do dynamic colours work, how do you give a colour dark and high-contrast variants, and when does a colour stop adapting?
A UIColor created with a closure (UIColor { traits in … }) or a named colour from an asset catalog is a dynamic colour: it holds several values and picks one… - What happens when text contains characters the font does not have, and why should you never hard-code system font names?
No font covers every script. When a character is missing, Core Text walks a cascade list of fallback fonts and draws that glyph with the first one that has it… - Which layouts and images mirror for right-to-left languages automatically, and what must you handle yourself in custom drawing?
The first-pass question covered leading and trailing constraints. The remaining gaps are components that mirror themselves and the things that never do. A…
More in Accessibility & localization
- 24.1 · VoiceOver, accessibility elements and the other ways people use an app
- 24.2 · Dynamic Type, display settings, contrast and touch targets
- 24.3 · Right-to-left layout, bidirectional text and number systems
- 24.4 · Testing localisation, and sorting, calendars and names by locale
- 24.5 · Auditing and testing accessibility, and making it a bar, not a backlog
- 24.6 · Building and testing accessible components
- 24.8 · Language matching, plural rules, string catalogs and Info.plist strings
- 24.9 · Unicode equivalence, word boundaries and regional defaults