SwiftUI: set custom underline to text?

Viewed 220

I have this piece of code:

var body: some View {
    ZStack {
        Color.black
            .opacity(0.8)
            .edgesIgnoringSafeArea(.all)
        
        (Text("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do ")
        +
        Text("eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, ")
            .underline(true, color: Color.yellow)
        +
        Text("quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."))
            .font(.system(size: 20, weight: .bold))
            .foregroundColor(.white)
            .lineSpacing(4.0)
            .padding(.horizontal, 12)
    }
}

enter image description here

I would like to customize the underline, like increasing the offset and the line height. How can I do so?

Thank you for your help

0 Answers
Related