Swift TextEditorの文字サイズを変更するサンプル
環境
Swift version 5.2.3 (swift-5.2.3-RELEASE)
Ubuntu 20.04.2 LTS
書式
TextEditor(text: $editText)
.font(.system(size: サイズ))
font修飾子の引数「.system(size:)」を指定します。
「.system(size:)」の引数「size」にフォントサイズを指定します。
使用例
struct ContentView: View {
@State var editText = ""
var body: some View {
VStack {
TextEditor(text: $editText)
.font(.system(size: 25))
.frame(width: 150, height: 80)
.border(Color.red, width: 4)
}
}
}
struct ContentView: View {
@State var editText = ""
var body: some View {
VStack {
TextEditor(text: $editText)
.font(.system(size: 25))
.frame(width: 150, height: 80)
.border(Color.red, width: 4)
}
}
}
struct ContentView: View { @State var editText = "" var body: some View { VStack { TextEditor(text: $editText) .font(.system(size: 25)) .frame(width: 150, height: 80) .border(Color.red, width: 4) } } }