---
title: closeSubpath()
framework: coregraphics
role: symbol
role_heading: Instance Method
path: coregraphics/cgmutablepath/closesubpath()
---

# closeSubpath()

Closes and completes a subpath in a mutable graphics path.

## Declaration

```swift
func closeSubpath()
```

## Discussion

Discussion Appends a line from the current point to the starting point of the current subpath and ends the subpath. After closing the subpath, your application can begin a new subpath without first calling CGPathMoveToPoint. In this case, a new subpath is implicitly created with a starting and current point equal to the previous subpath’s starting point.

## See Also

### Constructing a Graphics Path

- [move(to:transform:)](coregraphics/cgmutablepath/move(to:transform:).md)
- [addLine(to:transform:)](coregraphics/cgmutablepath/addline(to:transform:).md)
- [addLines(between:transform:)](coregraphics/cgmutablepath/addlines(between:transform:).md)
- [addRect(_:transform:)](coregraphics/cgmutablepath/addrect(_:transform:).md)
- [addRects(_:transform:)](coregraphics/cgmutablepath/addrects(_:transform:).md)
- [addEllipse(in:transform:)](coregraphics/cgmutablepath/addellipse(in:transform:).md)
- [addRoundedRect(in:cornerWidth:cornerHeight:transform:)](coregraphics/cgmutablepath/addroundedrect(in:cornerwidth:cornerheight:transform:).md)
- [addArc(center:radius:startAngle:endAngle:clockwise:transform:)](coregraphics/cgmutablepath/addarc(center:radius:startangle:endangle:clockwise:transform:).md)
- [addArc(tangent1End:tangent2End:radius:transform:)](coregraphics/cgmutablepath/addarc(tangent1end:tangent2end:radius:transform:).md)
- [addRelativeArc(center:radius:startAngle:delta:transform:)](coregraphics/cgmutablepath/addrelativearc(center:radius:startangle:delta:transform:).md)
- [addCurve(to:control1:control2:transform:)](coregraphics/cgmutablepath/addcurve(to:control1:control2:transform:).md)
- [addQuadCurve(to:control:transform:)](coregraphics/cgmutablepath/addquadcurve(to:control:transform:).md)
- [addPath(_:transform:)](coregraphics/cgmutablepath/addpath(_:transform:).md)
