.bold()
The .bold()
modifier applies a bold style to text characters in a View
.
Syntax
struct MyView: View {
var body: some View {
Text("I will be bold text!")
.bold()
}
}
Inside some View
, the .bold()
modifier is applied to all text within the Text
view.
Example
The following example creates some bold text:
import SwiftUIstruct BoldView: View {var body: some View {Text("I'm Bold Text!").bold()}}
In the above example, the .bold()
modifier is called on the Text
view. This applies a bold style to all text within the Text
view.
This will display: