RadialGradient

A radial gradient.

StructureiOS 13.0+macOS 10.15+tvOS 13.0+watchOS 6.0+RadialGradient in SwiftUI

Declaration

React
type RadialGradient =
  | { colors: Color[]; center: UnitPoint; startRadius: number; endRadius: number; }
  | { gradient: Gradient; center: UnitPoint; startRadius: number; endRadius: number; }
  | { stops: GradientStop[]; center: UnitPoint; startRadius: number; endRadius: number; };
Swift
@frozen nonisolated struct RadialGradient

Overview

The gradient applies the color function as the distance from a center point, scaled to fit within the defined start and end radii. The gradient maps the unit space center point into the bounding rectangle of each shape filled with the gradient.

When using a radial gradient as a shape style, you can also use ShapeStyle.radialGradient(_:center:startRadius:endRadius:).

From Apple’s SwiftUI documentation. Code samples there are Swift.

See also

More in Drawing and shapes.