35.5 Drawing Gradients
SwiftUI provides support for drawing gradients including linear, angular (conic) and radial gradients. In each case, the gradient is provided with a Gradient object initialized with an array of colors to be included in the gradient and values that control the way in which the gradient is rendered.
The following declaration, for example, generates a radial gradient consisting of five colors applied as the fill pattern for a Circle:
struct ContentView: View {
let colors = Gradient(colors: [Color.red, Color.yellow,
Color.green, Color.blue, Color.purple])
var body: some View {
Circle()
...