import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
//文本相关内容
Image(systemName: "globe")
.imageScale(.large)
.foregroundColor(.accentColor)
Text("Hello, world!".uppercased())//大写(.capitalized)
.font(.body)//调整字体大小(.title/.caption)
.fontWeight(.semibold)//调整字体粗细(.heavy/.ultraLight/.medium)
.bold()//粗体
.underline()
.underline(true,color: Color.red)//下划线(实线)
.italic()//斜体
.strikethrough(true,color: Color.green)//删除线
.font(.system(size: 24, weight: .semibold, design:. serif))
.baselineOffset(-50.0)//行距
.kerning(10)//字符间距(像素为单位)
.multilineTextAlignment(.leading)//文本对齐方式
.foregroundColor(.red)//字体颜色
.frame(width: 200,height: 100,alignment: .leading)//文本框
.minimumScaleFactor(0.1)//缩放字体(缩小到字体的百分之十)
}
}
}
效果图