---
title: "line(to:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsbezierpath/line(to:)"
---

# line(to:)

Appends a straight line to the path.

## Declaration

```swift
func line(to point: NSPoint)
```

## Parameters

- `point`: The destination point of the line segment, specified in the current coordinate system.

## Discussion

Discussion This method creates a straight line segment starting at the current point and ending at the point specified by the  aPoint parameter. The current point is the last point in the receiver’s most recently added segment. You must set the path’s current point (using the move(to:) method or through the creation of a preceding line or curve segment) before you invoke this method. If the path is empty, this method raises an genericException exception.

## See Also

### Constructing a Path

- [move(to:)](appkit/nsbezierpath/move(to:).md)
- [curve(to:controlPoint1:controlPoint2:)](appkit/nsbezierpath/curve(to:controlpoint1:controlpoint2:).md)
- [curve(to:controlPoint:)](appkit/nsbezierpath/curve(to:controlpoint:).md)
- [close()](appkit/nsbezierpath/close().md)
- [relativeMove(to:)](appkit/nsbezierpath/relativemove(to:).md)
- [relativeLine(to:)](appkit/nsbezierpath/relativeline(to:).md)
- [relativeCurve(to:controlPoint1:controlPoint2:)](appkit/nsbezierpath/relativecurve(to:controlpoint1:controlpoint2:).md)
- [relativeCurve(to:controlPoint:)](appkit/nsbezierpath/relativecurve(to:controlpoint:).md)
