How SwiftUI sets the spacing between the underline and the text?
问题 Code to set underline,I want to make the space between the text and the underline larger. Text("underline text") .underline() 回答1: Underline is a font feature, you can do custom under just by drawing line anywhere needed var body: some View { HStack { Text("Before") Text("underline text") .overlay( Rectangle().frame(height: 1).offset(y: 4) , alignment: .bottom) Text("after.") } } 回答2: You could create a custom view that takes the text and underline padding as parameters struct UnderlinedText: