leading(_:)
Adjusts the line spacing of a font.
Declaration
func leading(_ leading: Font.Leading) -> FontParameters
- leading:
The line spacing adjustment to apply.
Return Value
A modified font that uses the specified line spacing, or the original font if it doesn’t support line spacing adjustments.
Discussion
You can change a font’s line spacing while maintaining other characteristics of the font by applying this modifier. For example, you can decrease spacing of the body font by applying the Font.Leading.tight value to it:
let myFont = Font.body.leading(.tight)The availability of leading adjustments depends on the font. For some fonts, the modifier has no effect and returns the original font.