Skip to content

Commit 7dbf1a1

Browse files
gracekishinoSSwiniarskiDusch4593
authored
[Term Entry] SwiftUI ViewModifier: .bold() (#1411)
* [Term Entry] SwiftUI ViewModifier: `.bold()` #1333 * Update content/swiftui/concepts/viewmodifier/terms/bold/bold.md Co-authored-by: SSwiniarski <[email protected]> * Update content/swiftui/concepts/viewmodifier/terms/bold/bold.md Co-authored-by: SSwiniarski <[email protected]> * Update content/swiftui/concepts/viewmodifier/terms/bold/bold.md Co-authored-by: Brandon Dusch <[email protected]> * Update content/swiftui/concepts/viewmodifier/terms/bold/bold.md Co-authored-by: Brandon Dusch <[email protected]> * Update content/swiftui/concepts/viewmodifier/terms/bold/bold.md Co-authored-by: Brandon Dusch <[email protected]> * Update content/swiftui/concepts/viewmodifier/terms/bold/bold.md Co-authored-by: Brandon Dusch <[email protected]> * Update bold.md Format file Co-authored-by: SSwiniarski <[email protected]> Co-authored-by: Brandon Dusch <[email protected]>
1 parent 2ed6d04 commit 7dbf1a1

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
Title: '.bold()'
3+
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+
import SwiftUI
36+
37+
struct BoldView: 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.
46+
47+
This will display:
48+
49+
![SwiftUI ViewModifier .bold()](https://raw.githubusercontent.com/Codecademy/docs/main/media/swiftui-bold.png)

media/swiftui-bold.png

12.5 KB
Loading

0 commit comments

Comments
 (0)