Since iOS 15, we can set gradient as a Text color.
To do that, we can use foregroundStyle modifier.
Text(“Smash Swift”)
.font(.largeTitle)
.foregroundStyle(LinearGradient(colors: [.red, .blue],
startPoint: .leading,
endPoint: .trailing))
Result:
