---
title: setClip()
framework: appkit
role: symbol
role_heading: Instance Method
path: appkit/nsbezierpath/setclip()
---

# setClip()

Replaces the clipping path of the current graphics context with the area inside the path.

## Declaration

```swift
func setClip()
```

## Discussion

Discussion You should avoid using this method as a way of adjusting the clipping path, as it may expand the clipping path beyond the bounds set by the enclosing view. If you do use this method, be sure to save the graphics state prior to modifying the clipping path and restore the graphics state when you are done. This method uses the current winding rule to determine the clipping shape of the receiver. This method does not affect the receiver’s path.

## See Also

### Related Documentation

- [saveGraphicsState()](appkit/nsgraphicscontext/savegraphicsstate()-swift.method.md)
- [restoreGraphicsState()](appkit/nsgraphicscontext/restoregraphicsstate()-swift.method.md)

### Specifying a Clipping Path

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