.bold()
Published Jan 5, 2023Updated Mar 17, 2023
Contribute to Docs
The .bold()
modifier method applies a bold font weight to text.
Syntax
Text("I will be bold text!")
.bold()
The .bold()
modifier takes no parameters and returns a Text
view with bold text.
Example
The following example creates bolded text:
import SwiftUIstruct BoldView: View {var body: some View {Text("I'm Bold Text!").bold()}}
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:
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.
Learn SwiftUI on Codecademy
- Skill path
Build iOS Apps with SwiftUI
Learn how to build iOS applications with Swift and SwiftUI and publish them to Apples' App Store.Includes 7 CoursesWith CertificateBeginner Friendly13 hours - Free course
Learn Swift
A powerful programming language developed by Apple for iOS, macOS, and more.Beginner Friendly12 hours