<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/Shape/stroke(_:lineWidth:antialiased:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI5ShapePAAE6stroke_9lineWidth11antialiasedAA06StrokeC4ViewVyxqd__AA05EmptyI0VGqd___14CoreFoundation7CGFloatVSbtAA0C5StyleRd__lF"
  },
  "title" : "stroke(_:lineWidth:antialiased:)"
}
-->

# stroke(_:lineWidth:antialiased:)

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

```
@export(implementation) nonisolated func stroke<S>(_ content: S, lineWidth: CGFloat = 1, antialiased: Bool = true) -> StrokeShapeView<Self, S, EmptyView> where S : ShapeStyle
```

## Parameters

`content`

The color or gradient with which to stroke this shape.

`lineWidth`

The width of the stroke that outlines this shape.

## Return Value

A stroked shape.

## Discussion

The following example draws a circle with a purple stroke:

```
Circle().stroke(Color.purple, lineWidth: 5)
```

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)