ShapeView ModifieriOS 17.0+macOS 14.0+tvOS 17.0+watchOS 10.0+
Overloads
2 ways to call compose().stroke(). Each is one SwiftUI overload, picked by the arguments you pass.
compose().stroke(
content: SwiftUI.ShapeStyle,
options?: {
lineWidth?: number;
antialiased?: boolean;
}
)@export(implementation) nonisolated func stroke<S>(
_ content: S,
lineWidth: CGFloat = 1,
antialiased: Bool = true
) -> StrokeShapeView<Self.Content, S, Self>
where S : ShapeStyleParameters
content*SwiftUI.ShapeStyleThe color or gradient with which to stroke this shape.
options.lineWidthnumberThe width of the stroke that outlines this shape.
options.antialiasedbooleanA Boolean value that specifies whether to allow antialiasing. Pass
trueto allow antialising, otherwisefalse.
Return value
A stroked shape.
Discussion
The following example draws a circle with a purple stroke:
Circle().stroke(Color.purple, lineWidth: 5)See also
More in ShapeView modifiers.