---
title: "setLineCap(_:)"
framework: coregraphics
role: symbol
role_heading: Instance Method
path: "coregraphics/cgcontext/setlinecap(_:)"
---

# setLineCap(_:)

Sets the style for the endpoints of lines drawn in a graphics context.

## Declaration

```swift
func setLineCap(_ cap: CGLineCap)
```

## Parameters

- `cap`: A line cap style constant—doc://com.apple.coregraphics/documentation/CoreGraphics/CGLineCap/butt (the default), doc://com.apple.coregraphics/documentation/CoreGraphics/CGLineCap/round, or doc://com.apple.coregraphics/documentation/CoreGraphics/CGLineCap/square. See doc://com.apple.coregraphics/documentation/CoreGraphics/CGPath.

## See Also

### Setting Path Drawing Options

- [setAllowsAntialiasing(_:)](coregraphics/cgcontext/setallowsantialiasing(_:).md)
- [setFlatness(_:)](coregraphics/cgcontext/setflatness(_:).md)
- [setLineDash(phase:lengths:)](coregraphics/cgcontext/setlinedash(phase:lengths:).md)
- [setLineJoin(_:)](coregraphics/cgcontext/setlinejoin(_:).md)
- [setLineWidth(_:)](coregraphics/cgcontext/setlinewidth(_:).md)
- [setMiterLimit(_:)](coregraphics/cgcontext/setmiterlimit(_:).md)
- [setPatternPhase(_:)](coregraphics/cgcontext/setpatternphase(_:).md)
- [setFillPattern(_:colorComponents:)](coregraphics/cgcontext/setfillpattern(_:colorcomponents:).md)
- [setShouldAntialias(_:)](coregraphics/cgcontext/setshouldantialias(_:).md)
