文字视图(Text)
简单初始化一个文字视图
Text("Hello World")
修改文字属性
Text("Stay Hungry. Stay Foolish.Stay Hungry. Stay Foolish.Stay Hungry. Stay Foolish.Stay Hungry. Stay Foolish.Stay Hungry. Stay Foolish.Stay Hungry. Stay Foolish.Stay Hungry. Stay Foolish.Stay Hungry. Stay Foolish.Stay Hungry. Stay Foolish.Stay Hungry. Stay Foolish.Stay Hungry. Stay Foolish.Stay Hungry. Stay Foolish.Stay Hungry. Stay Foolish.Stay Hungry. Stay Foolish.Stay Hungry. Stay Foolish.Stay Hungry. Stay Foolish.Stay Hungry.")
.fontWeight(.bold) //设置字重
.font(.title) //设置字体
.foregroundColor(.green)//字体颜色
.multilineTextAlignment(.center) //对齐方式
// .lineLimit(3) //最大行数
// .truncationMode(.head) //截断方式
.lineSpacing(10) //文字行间距
// .padding() //组件边距
修改字体设计
// 让字体圆润
.font(.system(.largeTitle, design: .rounded))
2d旋转
.rotationEffect(.degrees(20), anchor: UnitPoint(x: 0, y: 0))
3d旋转
.rotation3DEffect(.degrees(60), axis: (x: 1, y: 0, z: 0))
阴影
.shadow(color: .gray, radius: 2, x: 0, y: 15)
markdown 支持
SwiftUI text 视图已支持markdown