One Logo Pool Ball
SwiftUICore · IOS API REFERENCE

AnyGradient

struct · iOS 16.0+ · SDK 27.1

@frozen struct AnyGradient

A color gradient. When used as a ``ShapeStyle``, this type draws a linear gradient with start-point [0.5, 0] and end-point [0.5, 1].

Members (2)

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 16.0+

init

TypeScript
static init(gradient: Gradient): AnyGradient
Swift declaration
init(_ gradient: Gradient)

Creates a new instance from the specified gradient.

Skipped declarations

No declarations were skipped in this snapshot.

All SwiftUICore types →