@@ -13,11 +13,40 @@ struct TextPlayground: View {
1313 Example ( " Verbatim " ) { Text ( verbatim: " Raw string, no interpolation " ) }
1414 Example ( " Interpolated " ) { Text ( " Counter is \( counter) " ) }
1515 Example ( " Bump the counter " ) { Button ( " Increment " ) { counter += 1 } }
16+ Example ( " Font sizes " ) {
17+ VStack ( alignment: . leading, spacing: 4 ) {
18+ Text ( " Large title " ) . font ( . largeTitle)
19+ Text ( " Title " ) . font ( . title)
20+ Text ( " Headline " ) . font ( . headline)
21+ Text ( " Body " ) . font ( . body)
22+ Text ( " Caption " ) . font ( . caption)
23+ }
24+ }
25+ Example ( " Weight & style " ) {
26+ VStack ( alignment: . leading, spacing: 4 ) {
27+ Text ( " Bold " ) . bold ( )
28+ Text ( " Semibold " ) . fontWeight ( . semibold)
29+ Text ( " Italic " ) . italic ( )
30+ Text ( " System 24 heavy " ) . font ( . system( size: 24 , weight: . heavy) )
31+ }
32+ }
33+ Example ( " Colors " ) {
34+ VStack ( alignment: . leading, spacing: 4 ) {
35+ Text ( " Red " ) . foregroundColor ( . red)
36+ Text ( " Blue " ) . foregroundColor ( . blue)
37+ Text ( " Green, bold, title " ) . font ( . title) . bold ( ) . foregroundColor ( . green)
38+ }
39+ }
40+ Example ( " Line limit " ) {
41+ Text ( " A longer passage of text that wraps onto multiple lines, capped at two by lineLimit so the rest is truncated. " )
42+ . lineLimit ( 2 )
43+ }
1644 Example ( " Multiline " ) {
1745 Text ( " A longer passage of text that wraps onto multiple lines when it no longer fits within the width of the screen. " )
1846 }
1947 Example ( " Styled " ) {
2048 Text ( " Blue on a rounded chip " )
49+ . foregroundColor ( . white)
2150 . padding ( )
2251 . background ( Color . blue)
2352 . cornerRadius ( 12 )
0 commit comments