iOS 26 introduces the lineHeight(_:) SwiftUI modifier and AttributedString.LineHeight attribute for controlling baseline distance between lines of text. The API offers preset options (loose, tight, normal, variable) and precise methods: multiple(factor:) for proportional scaling, leading(increase:) for relative-plus-fixed spacing, and exact(points:) for fixed point values. A comparison with the existing lineSpacing(_:) modifier clarifies that lineHeight measures baseline-to-baseline distance while lineSpacing measures bottom-of-line to top-of-next. The older leading(_:) font modifier (available since iOS 14) is also discussed as a more limited alternative. Caution is advised when using exact(points:) since it does not scale with Dynamic Type and can cause text overlap at larger font sizes.

5m read timeFrom nilcoalescing.com
Post cover image
Table of contents
# LineHeight type properties# LineHeight type methodslineHeight(_:) vs lineSpacing(_:)leading(_:) font modifier
1 Impression