The gradient to use for filling the shape, providing the colors and their relative stop locations.
Type Method
型メソッド
conic
conicGradient(_:center:angle:)
A conic gradient that completes a full turn, optionally starting from a given angle and anchored to a relative center point within the filled shape.
Availability 有効性
- iOS 13.0+
- iPadOS 13.0+
- macOS 10.15+
- Mac Catalyst 13.0+
- tvOS 13.0+
- watchOS 6.0+
Technology
- Swift
UI
Declaration 宣言
static func conicGradient(_ gradient: Gradient
, center: UnitPoint
, angle: Angle
= .zero) -> AngularGradient
Available when
Self
is AngularGradient
.Parameters パラメータ
gradient
center
The relative center of the gradient, mapped from the unit space into the bounding rectangle of the filled shape.
angle
The angle to offset the beginning of the gradient’s full turn.
Discussion 議論
For example, a conic gradient used as a background:
let gradient = Gradient(colors: [.red, .yellow])
ContentView()
.background(.conicGradient(gradient))
For information about how to use shape styles, see Shape
.