どうも、ちょげ(@chogetarou)です。
Textの文字色を変える方法を紹介します。
方法

Textの文字色を変更するには、foregroundColor修飾子を使います。
まず、TextにforegroundColor修飾子を付与します。
そして、foregroundColor修飾子の引数に色を指定します。
Text("テキスト")
.foregroundColor(文字色)
foregroundColor修飾子の引数に指定した色が、Textの文字色になります。
使用例

struct ContentView: View {
var body: some View {
VStack {
Text("Hello, SwiftUI")
.foregroundColor(.red)
}
}
}
コメント