<!--
{
  "availability" : [
    "macOS: 10.9.0 -",
    "swift: 4.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreFoundation",
  "identifier" : "/documentation/CoreFoundation/CGRect/clip()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Foundation",
      "CoreFoundation"
    ],
    "preciseIdentifier" : "s:So6CGRectV6AppKitE4clipyyF"
  },
  "title" : "clip()"
}
-->

# clip()

Modifies the current graphics context clipping path by intersecting it
with this rect.
This permanently modifies the graphics state, so the current state should
be saved beforehand and restored afterwards.

```
func clip()
```

## Discussion> precondition: There must be a set current NSGraphicsContext.

---

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)