<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSBezierPath/line(to:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSBezierPath(im)lineToPoint:"
  },
  "title" : "line(to:)"
}
-->

# line(to:)

Appends a straight line to the path.

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

## Parameters

`point`

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

## 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:)`](/documentation/AppKit/NSBezierPath/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 <doc://com.apple.documentation/documentation/Foundation/NSExceptionName/genericException> exception.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)