どうも、ちょげ(@chogetarou)です。
Textに色付きの取り消し線をつける方法を紹介します。
方法

Textに色付きの取り消し線をつけるには、strikethrought(_:color:)修飾子を使います。
まず、Textにstrikethrough修飾子を付与します。
そして、strikethrough修飾子の引数「color」に色を指定します。
Text("テキスト")
.strikethrough(color: 色)
引数「color」に色を指定したstrikethrough修飾子を付与することで、Textに色付きの取り消し線をつけることができます。
使用例

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