You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description: 'Applies a bold style to text characters in a View.'
4
+
Subjects:
5
+
- 'Mobile Development'
6
+
- 'iOS'
7
+
Tags:
8
+
- 'SwiftUI'
9
+
- 'SwiftUI Modifiers'
10
+
CatalogContent:
11
+
- 'learn-swift'
12
+
- 'paths/build-ios-apps-with-swiftui'
13
+
---
14
+
15
+
The **`.bold()`** modifier applies a bold style to text characters in a [`View`](https://www.codecademy.com/resources/docs/swiftui/views).
16
+
17
+
## Syntax
18
+
19
+
```pseudo
20
+
struct MyView: View {
21
+
var body: some View {
22
+
Text("I will be bold text!")
23
+
.bold()
24
+
}
25
+
}
26
+
```
27
+
28
+
Inside `some View`, the `.bold()` modifier is applied to all text within the [`Text` view](https://www.codecademy.com/resources/docs/swiftui/views/text).
29
+
30
+
## Example
31
+
32
+
The following example creates some bold text:
33
+
34
+
```swift
35
+
importSwiftUI
36
+
37
+
structBoldView: View {
38
+
var body: some View {
39
+
Text("I'm Bold Text!")
40
+
.bold()
41
+
}
42
+
}
43
+
```
44
+
45
+
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.
0 commit comments