Is there a way to modify a Text view to have an underline? For example like this text below:
y͟o͟u͟r͟ t͟e͟x͟t͟
Text(Constants.chooseText)
.font(Font.system(size: 26))
.foregroundColor(Color.white)
.padding(.bottom, 80)
Add double asterisks (**) arroud the text/characters to make it bold.
Here is the solution in storyboard: Open the Attribute Inspector (make sure label is selected), Change the dropdown value from 'Plain' to 'Attributed'. Now a a small text editor will be visible under the font of the label. Select the text of the label, right click and change the font to 'underline'.
Text in SwiftUI is a view that lets you display one or more lines of text. This is suitable for read-only information that's not editable. To display a line of text, you initialize Text and set a String value.
Add the underline modifier, on the Text View
Text("Hello, world!")
.underline()
UPDATE adding underline() as the first modifier solved the issue.
Text(Constants.chooseText)
.underline()
.font(Font.system(size: 26))
.foregroundColor(Color.white)
.padding(.bottom, 80)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With