Text view in SwiftUI

Posted on Jul 4th, 2019

The Text structure in SwiftUI is a view that displays lines of text. Various modifiers are available to customize the appearance and style of text.

Text("Hello World")
Text("Hello World").bold()
Text("Hello World").italic()
Text("Hello World").color(.red)
Text("Hello World").fontWeight(.ultraLight)
Text("Hello World").underline()
Text("Hello World").underline(true, color: .red)
Text("Hello World").strikethrough()
Text("Hello World").strikethrough(true, color: .green)


See Appleā€™s documentation for more information.