Supporting Dynamic Type at Airbnb

An overview of process, tips, and pitfalls we learned while bringing Dynamic Type to Airbnb. For you to reference when supporting Dynamic Type in your apps too!

Background

30% of people using the app had a preferred font size that was not the default.

Font size selection in iOS

Why is it important?

Design

Engineering

  1. The unscaled units which are shown to users with the default font size, and are the values we set when creating font attributes.
  2. The scaled units which fit the preferredContentSizeCategory and are what we read at runtime.
func scaledFont(for font: UIFont, compatibleWith traitCollection: UITraitCollection?) -> UIFont
func scaledValue(for value: CGFloat, compatibleWith traitCollection: UITraitCollection?) -> CGFloat
Scaled pointSize and lineHeight vary between method 1 and method 2
Default (large) preferred content size
AccessibilityExtraExtraExtraLarge preferredContentSize

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Noah Martin

Co-founder of Emerge Tools, previously software engineer at Airbnb.