---
title: "stroke(_:with:lineWidth:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/graphicscontext/stroke(_:with:linewidth:)"
---

# stroke(_:with:lineWidth:)

Draws a path into the context with a specified line width.

## Declaration

```swift
func stroke(_ path: Path, with shading: GraphicsContext.Shading, lineWidth: CGFloat = 1)
```

## Parameters

- `path`: The path to outline.
- `shading`: The color or pattern to use when outlining the path.
- `lineWidth`: The width of the stroke, which defaults to 1.

## Discussion

Discussion When you call this method, all StrokeStyle properties other than lineWidth take their default values. To control other style properties, use stroke(_:with:style:) instead.

## See Also

### Drawing a path

- [stroke(_:with:style:)](swiftui/graphicscontext/stroke(_:with:style:).md)
- [fill(_:with:style:)](swiftui/graphicscontext/fill(_:with:style:).md)
- [GraphicsContext.Shading](swiftui/graphicscontext/shading.md)
- [GraphicsContext.GradientOptions](swiftui/graphicscontext/gradientoptions.md)
