<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSBezierPath/strokeLine(from:to:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSBezierPath(cm)strokeLineFromPoint:toPoint:"
  },
  "title" : "strokeLine(from:to:)"
}
-->

# strokeLine(from:to:)

Strokes a line between two points using the current stroke color and the default drawing attributes.

```
class func strokeLine(from point1: NSPoint, to point2: NSPoint)
```

## Parameters

`point1`

The starting point of the line.

`point2`

The ending point of the line.

## Discussion

This method strokes the specified path immediately.

## See Also

[`-  moveToPoint:`](/documentation/AppKit/NSBezierPath/move(to:))

Moves the path’s current point to the specified location.

[`-  lineToPoint:`](/documentation/AppKit/NSBezierPath/line(to:))

Appends a straight line to the path.



---

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)