---
title: NSBezierPath
framework: appkit
role: symbol
role_heading: Class
path: appkit/nsbezierpath
---

# NSBezierPath

An object that can create paths using PostScript-style commands.

## Declaration

```swift
class NSBezierPath
```

## Overview

Overview Paths consist of straight and curved line segments joined together. Paths can form recognizable shapes such as rectangles, ovals, arcs, and glyphs; they can also form complex polygons using either straight or curved line segments. A single path can be closed by connecting its two endpoints, or it can be left open. An NSBezierPath object can contain multiple disconnected paths, whether they are closed or open. Each of these paths is referred to as a subpath. The subpaths of a Bézier path object must be manipulated as a group. The only way to manipulate subpaths individually is to create separate NSBezierPath objects for each. For a given NSBezierPath object, you can stroke the path’s outline or fill the region occupied by the path. You can also use the path as a clipping region for views or other regions. Using methods of NSBezierPath, you can also perform hit detection on the filled or stroked path. Hit detection is needed to implement interactive graphics, as in rubber banding and dragging operations. The current graphics context is automatically saved and restored for all drawing operations involving Bézier path objects, so your application does not need to worry about the graphics settings changing across invocations.

## Topics

### Creating a Bézier Path

- [init(ovalIn:)](appkit/nsbezierpath/init(ovalin:).md)
- [init(rect:)](appkit/nsbezierpath/init(rect:).md)
- [init(roundedRect:xRadius:yRadius:)](appkit/nsbezierpath/init(roundedrect:xradius:yradius:).md)
- [init(cgPath:)](appkit/nsbezierpath/init(cgpath:)-96cxk.md)
- [flattened](appkit/nsbezierpath/flattened.md)
- [reversed](appkit/nsbezierpath/reversed.md)

### Constructing a Path

- [move(to:)](appkit/nsbezierpath/move(to:).md)
- [line(to:)](appkit/nsbezierpath/line(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)

### Appending Common Shapes to a Path

- [append(_:)](appkit/nsbezierpath/append(_:).md)
- [appendPoints(_:count:)](appkit/nsbezierpath/appendpoints(_:count:).md)
- [appendOval(in:)](appkit/nsbezierpath/appendoval(in:).md)
- [appendArc(from:to:radius:)](appkit/nsbezierpath/appendarc(from:to:radius:).md)
- [appendArc(withCenter:radius:startAngle:endAngle:)](appkit/nsbezierpath/appendarc(withcenter:radius:startangle:endangle:).md)
- [appendArc(withCenter:radius:startAngle:endAngle:clockwise:)](appkit/nsbezierpath/appendarc(withcenter:radius:startangle:endangle:clockwise:).md)
- [appendRect(_:)](appkit/nsbezierpath/appendrect(_:).md)
- [appendRoundedRect(_:xRadius:yRadius:)](appkit/nsbezierpath/appendroundedrect(_:xradius:yradius:).md)
- [append(withCGGlyph:in:)](appkit/nsbezierpath/append(withcgglyph:in:).md)
- [append(withCGGlyphs:count:in:)](appkit/nsbezierpath/append(withcgglyphs:count:in:).md)
- [appendGlyph(_:in:)](appkit/nsbezierpath/appendglyph(_:in:).md)
- [appendGlyphs(_:count:in:)](appkit/nsbezierpath/appendglyphs(_:count:in:).md)
- [appendPackedGlyphs(_:)](appkit/nsbezierpath/appendpackedglyphs(_:).md)

### Accessing a Path’s Attributes

- [windingRule](appkit/nsbezierpath/windingrule-swift.property.md)
- [lineCapStyle](appkit/nsbezierpath/linecapstyle-swift.property.md)
- [lineJoinStyle](appkit/nsbezierpath/linejoinstyle-swift.property.md)
- [lineWidth](appkit/nsbezierpath/linewidth.md)
- [miterLimit](appkit/nsbezierpath/miterlimit.md)
- [flatness](appkit/nsbezierpath/flatness.md)
- [getLineDash(_:count:phase:)](appkit/nsbezierpath/getlinedash(_:count:phase:).md)
- [setLineDash(_:count:phase:)](appkit/nsbezierpath/setlinedash(_:count:phase:).md)

### Configuring Default Path Attributes

- [defaultWindingRule](appkit/nsbezierpath/defaultwindingrule.md)
- [defaultLineCapStyle](appkit/nsbezierpath/defaultlinecapstyle.md)
- [defaultLineJoinStyle](appkit/nsbezierpath/defaultlinejoinstyle.md)
- [defaultLineWidth](appkit/nsbezierpath/defaultlinewidth.md)
- [defaultMiterLimit](appkit/nsbezierpath/defaultmiterlimit.md)
- [defaultFlatness](appkit/nsbezierpath/defaultflatness.md)

### Drawing a Path

- [stroke()](appkit/nsbezierpath/stroke().md)
- [fill()](appkit/nsbezierpath/fill().md)
- [fill(_:)](appkit/nsbezierpath/fill(_:).md)
- [stroke(_:)](appkit/nsbezierpath/stroke(_:).md)
- [strokeLine(from:to:)](appkit/nsbezierpath/strokeline(from:to:).md)
- [drawPackedGlyphs(_:at:)](appkit/nsbezierpath/drawpackedglyphs(_:at:).md)

### Specifying a Clipping Path

- [addClip()](appkit/nsbezierpath/addclip().md)
- [setClip()](appkit/nsbezierpath/setclip().md)
- [clip(_:)](appkit/nsbezierpath/clip(_:).md)

### Performing Hit-Testing

- [contains(_:)](appkit/nsbezierpath/contains(_:).md)

### Querying a Path

- [bounds](appkit/nsbezierpath/bounds.md)
- [controlPointBounds](appkit/nsbezierpath/controlpointbounds.md)
- [currentPoint](appkit/nsbezierpath/currentpoint.md)
- [isEmpty](appkit/nsbezierpath/isempty.md)

### Applying Transformations

- [transform(using:)](appkit/nsbezierpath/transform(using:).md)

### Accessing Elements of a Path

- [cgPath](appkit/nsbezierpath/cgpath.md)
- [elementCount](appkit/nsbezierpath/elementcount.md)
- [element(at:)](appkit/nsbezierpath/element(at:).md)
- [element(at:associatedPoints:)](appkit/nsbezierpath/element(at:associatedpoints:).md)
- [removeAllPoints()](appkit/nsbezierpath/removeallpoints().md)
- [setAssociatedPoints(_:at:)](appkit/nsbezierpath/setassociatedpoints(_:at:).md)

### Constants

- [NSBezierPath.ElementType](appkit/nsbezierpath/elementtype.md)
- [NSBezierPath.LineJoinStyle](appkit/nsbezierpath/linejoinstyle-swift.enum.md)
- [NSBezierPath.LineCapStyle](appkit/nsbezierpath/linecapstyle-swift.enum.md)
- [NSBezierPath.WindingRule](appkit/nsbezierpath/windingrule-swift.enum.md)

### Initializers

- [init(CGPath:)](appkit/nsbezierpath/init(cgpath:)-4nao7.md)
- [init(coder:)](appkit/nsbezierpath/init(coder:).md)
- [init(ovalInRect:)](appkit/nsbezierpath/init(ovalinrect:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSCoding](foundation/nscoding.md)
- [NSCopying](foundation/nscopying.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)
- [NSSecureCoding](foundation/nssecurecoding.md)

## See Also

### Shapes and Paths

- [Convenience Functions](appkit/convenience-functions.md)
