---
title: "stroke(_:style:antialiased:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/shape/stroke(_:style:antialiased:)"
---

# stroke(_:style:antialiased:)

Traces the outline of this shape with a color or gradient.

## Declaration

```swift
nonisolated func stroke<S>(_ content: S, style: StrokeStyle, antialiased: Bool = true) -> StrokeShapeView<Self, S, EmptyView> where S : ShapeStyle
```

## Parameters

- `content`: The color or gradient with which to stroke this shape.
- `style`: The stroke characteristics — such as the line’s width and whether the stroke is dashed — that determine how to render this shape.

## Return Value

Return Value A stroked shape.

## Discussion

Discussion The following example adds a dashed purple stroke to a Capsule: Capsule() .stroke(     Color.purple,     style: StrokeStyle(         lineWidth: 5,         lineCap: .round,         lineJoin: .miter,         miterLimit: 0,         dash: [5, 10],         dashPhase: 0     ) )

## See Also

### Setting the stroke characteristics

- [stroke(_:lineWidth:)](swiftui/shape/stroke(_:linewidth:).md)
- [stroke(_:lineWidth:antialiased:)](swiftui/shape/stroke(_:linewidth:antialiased:).md)
- [stroke(lineWidth:)](swiftui/shape/stroke(linewidth:).md)
- [stroke(_:style:)](swiftui/shape/stroke(_:style:).md)
- [stroke(style:)](swiftui/shape/stroke(style:).md)
