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

# setClip()

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

```
func setClip()
```

## 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

[`-  saveGraphicsState`](/documentation/AppKit/NSGraphicsContext/saveGraphicsState()-swift.method)

Saves the current graphics state and creates a new graphics state on the top of the stack.

[`-  restoreGraphicsState`](/documentation/AppKit/NSGraphicsContext/restoreGraphicsState()-swift.method)

Removes the context’s graphics state from the top of the graphics state stack and makes the next graphics state the current graphics state.



---

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)