---
title: "addLine(to:transform:)"
framework: coregraphics
role: symbol
role_heading: Instance Method
path: "coregraphics/cgmutablepath/addline(to:transform:)"
---

# addLine(to:transform:)

Appends a straight line segment from the current point to the specified point.

## Declaration

```swift
func addLine(to point: CGPoint, transform: CGAffineTransform = .identity)
```

## Parameters

- `point`: The location, in user space coordinates, for the end of the new line segment.
- `transform`: An affine transform to apply to the point before adding to the path. Defaults to the identity transform if not specified.

## Discussion

Discussion After adding the line segment, the current point is set to the endpoint of the line segment.

## See Also

### Constructing a Graphics Path

- [move(to:transform:)](coregraphics/cgmutablepath/move(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)
- [closeSubpath()](coregraphics/cgmutablepath/closesubpath().md)
