Skip to content

Commit aaa935c

Browse files
committed
Implement View.bold() modifier
1 parent f0107f9 commit aaa935c

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed
Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
11
extension View {
22
public func font(_ font: Font) -> some View {
33
EnvironmentModifier(self) { environment in
4-
// TODO: Merge fonts?
54
environment.with(\.font, font)
65
}
76
}
7+
8+
public func bold() -> some View {
9+
EnvironmentModifier(self) { environment in
10+
let font =
11+
switch environment.font {
12+
case let .system(size, _, design):
13+
Font.system(size: size, weight: .bold, design: design)
14+
}
15+
16+
return environment.with(
17+
\.font,
18+
font
19+
)
20+
}
21+
}
822
}

0 commit comments

Comments
 (0)