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

# stroke(_:lineWidth:)

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

```
nonisolated func stroke<S>(_ content: S, lineWidth: CGFloat = 1) -> some View 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)