---
title: "addLines(_:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/path/addlines(_:)"
---

# addLines(_:)

Adds a sequence of connected straight-line segments to the path.

## Declaration

```swift
mutating func addLines(_ lines: [CGPoint])
```

## Discussion

Discussion Calling this convenience method is equivalent to applying the transform to all points in the array, then calling the move(to:) method with the first value in the points array, then calling the addLine(to:) method for each subsequent point until the array is exhausted. After calling this method, the path’s current point is the last point in the array. Parameter: lines: An array of values that specify the start and end points of the line segments to draw. Each point in the array specifies a position in user space. The first point in the array specifies the initial starting point. transform: An affine transform to apply to the points before adding to the path. Defaults to the identity transform if not specified.

## See Also

### Drawing a path

- [move(to:)](swiftui/path/move(to:).md)
- [addArc(center:radius:startAngle:endAngle:clockwise:transform:)](swiftui/path/addarc(center:radius:startangle:endangle:clockwise:transform:).md)
- [addArc(tangent1End:tangent2End:radius:transform:)](swiftui/path/addarc(tangent1end:tangent2end:radius:transform:).md)
- [addCurve(to:control1:control2:)](swiftui/path/addcurve(to:control1:control2:).md)
- [addEllipse(in:transform:)](swiftui/path/addellipse(in:transform:).md)
- [addLine(to:)](swiftui/path/addline(to:).md)
- [addPath(_:transform:)](swiftui/path/addpath(_:transform:).md)
- [addQuadCurve(to:control:)](swiftui/path/addquadcurve(to:control:).md)
- [addRect(_:transform:)](swiftui/path/addrect(_:transform:).md)
- [addRects(_:transform:)](swiftui/path/addrects(_:transform:).md)
- [addRelativeArc(center:radius:startAngle:delta:transform:)](swiftui/path/addrelativearc(center:radius:startangle:delta:transform:).md)
- [addRoundedRect(in:cornerSize:style:transform:)](swiftui/path/addroundedrect(in:cornersize:style:transform:).md)
- [closeSubpath()](swiftui/path/closesubpath().md)
