Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reducing Line Spacing of Text in SwiftUI

Tags:

For some fonts, the built-in line spacing is unpleasantly large.

SwiftUI gives us the Text modifier .lineSpacing() to adjust the spacing between lines of text (also called the leading, unrelated to leading/trailing). Its value specifies the number of points of additional spacing to place between consecutive lines of text, so that .lineSpacing(0) results in no change. Unfortunately, it does not appear to respond to negative values; .lineSpacing(-10) yields the same result as lineSpacing(0).

Does anyone know of a way to reduce line spacing in SwiftUI without resorting to UIKit?