Text
字体 .font
字体颜色 .foregroundcolor
文本切换动画
contentTransition .contentTransition(.numericText())
截断 FormatDisplay
Text("Hamlet") .font(.largeTitle) .strikethrough(true,color:.red)
Text("Hamlet") .font(.largeTitle) .underline(true.color:.green)
Text("ABCDEF") .kerning(-3) Text("ABCDEF") Text("ABCDEF") .kerning(3)
Text("ABCDEF") tracking(-3) Text("ABCDEF") Text("ABCDEF") tracking(3)
Text("Hello") baseline0ffset(-10) .border(Color.red) Text("Hello") .border(Color.green) Text("Hello") .baselineOffset(10) .border(Color.blue) .background(Color(white:0.9))
Text("Hamlet") .textCase(.uppercase)
Text("Thisis is a string in a TextField with 10 point spacing applied between the bottom ofonelineandthetopofthenext.") .frame(width:200,height:200,alignment:.leading) .lineSpacing(10) .background(Color.red)
Text("Thisis is a block of text that will show up in a ttext element as multiple lines.("\n") Here we have chosen to center this ttext." frame(width:200,height:200,alignment:.leadinng) .multilineTextAlignment(.center)
Text("helloworld") .flipsForRightToLeftLayoutDirection(true) environment(.layoutDirection,.rightToLeft)