The .bold() modifier method applies a bold font weight to text.


Text("I will be bold text!")

The .bold() modifier takes no parameters and returns a Text view with bold text.


The following example creates bolded text:

import SwiftUI
struct BoldView: View {
var body: some View {
Text("I'm Bold Text!")

In the above example, the .bold() modifier is applied on the Text view, which applies a bold style to all the text within the Text view.

This will display the following:

SwiftUI ViewModifier .bold()

Looking to contribute?

Learn SwiftUI on Codecademy