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

# clip()

Modifies the current graphics context clipping path by intersecting it
with the graphical union of this list of rects
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)