Text("显示文本")
Text("修改文字颜色")
.foregroundColor(.blue)
Text("修改背景颜色")
.background(Color.yellow)
Text("文字模糊效果")
.blur(radius: 1)
Text("背景模糊效果")
.background(Color.yellow.blur(radius: 10))
Text("修改文字颜色")
.background(Color.yellow)
.blur(radius: 5)
Text("修改字体")
.font(.body)
Text("修改字重")
.fontWeight(.semibold)
Text("修改文字大小")
.font(.system(size: 20))
Text("设置控件大小")
.frame(width: 70, height: 100)
.background(Color.yellow)
Text("设置文字对齐方式)
.frame(width: 70, height: 100, alignment: .top)
.background(Color.yellow)
Text("设置显示排数")
.frame(width: 70, height: 100)
.lineLimit(1)
.background(Color.yellow)
Text("多排文字显示,设置间距")
.frame(width: 70, height: 100)
.background(Color.yellow)
.lineSpacing(10)
Text("文字多拍显示,设置对齐方式")
.frame(width: 70, height: 100)
.background(Color.yellow)
.multilineTextAlignment(.center)
Text("切角")
.frame(width: 70, height: 50)
.background(Color.yellow)
.cornerRadius(10)
Text("圆角")
.frame(width: 70, height: 50)
.background(Color.yellow)
.clipShape(Capsule())
Text("椭圆")
.frame(width: 70, height: 50)
.background(Color.yellow)
.clipShape(Ellipse())
Text("圆")
.frame(width: 70, height: 50)
.background(Color.yellow)
.clipShape(Circle())
Text("添加文字阴影")
.shadow(color: .blue, radius: 2, x: 5, y: 10)
Text("添加边框阴影")
.frame(width: 120, height: 40)
.background(Color.yellow.shadow(color: .blue, radius: 2, x: 0, y: 0))
Text("添加整体阴影")
.frame(width: 120, height: 40)
.background(Color.yellow)
.shadow(color: .blue, radius: 2, x: 0, y: 0)
Text("单点")
.onTapGesture {
print(" 单点 ")
}
Text("双击")
.onTapGesture(count: 2) {
print(" 双击 ")
}
Text("长按")
.onLongPressGesture {
print(" 长按 ")
}
如需其他其他效果,可以评论留言,笔者有时间将会补充
源码链接: https://pan.baidu.com/s/1yt62R4FKWSOobo1eMxXOeg 提取码: ssoo