One Logo Pool Ball
SwiftUICore · IOS API REFERENCE

Gradient

struct · iOS 13.0+ · SDK 27.1

@frozen struct Gradient

A color gradient represented as an array of color stops, each having a parametric location value.

Members (5)

method · iOS 16.0+

colorSpace

TypeScript
colorSpace(space: Gradient_ColorSpace): AnyGradient
Swift declaration
func colorSpace(_ space: Gradient.ColorSpace) -> AnyGradient

Returns a version of the gradient that will use a specified color space for interpolating between its colors. Rectangle().fill(.linearGradient( colors: [.white, .blue]).colorSpace(.perceptual)) - Parameters: - space: The color space the new gradient will use to interpolate its constituent colors. - Returns: A new gradient that interpolates its colors in the specified color space.

init · iOS 13.0+

init

TypeScript
static initStops(stops: Array<Gradient_Stop>): Gradient
Swift declaration
init(stops: [Gradient.Stop])

Creates a gradient from an array of color stops.

get · iOS 13.0+

stops

TypeScript
get stops(): Array<Gradient_Stop>
Swift declaration
var stops: [Gradient.Stop]

The array of color stops.

set · iOS 13.0+

stops

TypeScript
set stops(value: Array<Gradient_Stop>)
Swift declaration
var stops: [Gradient.Stop]

The array of color stops.

init · iOS 13.0+

init

TypeScript
static initColors(colors: Array<Color>): Gradient
Swift declaration
init(colors: [Color])

Creates a gradient from an array of colors. The gradient synthesizes its location values to evenly space the colors along the gradient.

Skipped declarations

No declarations were skipped in this snapshot.

All SwiftUICore types →