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

# stroke(_:with:style:)

Draws a path into the context with a specified stroke style.

## Declaration

```swift
func stroke(_ path: Path, with shading: GraphicsContext.Shading, style: StrokeStyle)
```

## Parameters

- `path`: The path to outline.
- `shading`: The color or pattern to use when outlining the path.
- `style`: A style that indicates how to outline the path.

## Discussion

Discussion If you only need to control the style’s lineWidth property, use stroke(_:with:lineWidth:) instead.

## See Also

### Drawing a path

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