<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "tvOS: -",
    "visionOS: -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIRectClip(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:@F@UIRectClip"
  },
  "title" : "UIRectClip(_:)"
}
-->

# UIRectClip(_:)

Modifies the current clipping path by intersecting it with the specified rectangle.

```
func UIRectClip(_ rect: CGRect)
```

## Parameters

`rect`

The rectangle to intersect with the clipping region. If the width or height of the rectangle are less than 0, this function does not change the clipping path.

## Discussion

Each call to this function permanently shrinks the clipping path of the current graphics context using the specified rectangle. You cannot use this function to expand the clipping region path. If the current graphics context is `nil`, this function does nothing.

If you need to return the clipping path to its original shape in your drawing code, you should save the current graphics context before calling this function. To save the current state of the graphics context, call the <doc://com.apple.documentation/documentation/CoreGraphics/CGContext/saveGState()> function before making your modifications. When you are ready to restore the original clipping region, you can then use the <doc://com.apple.documentation/documentation/CoreGraphics/CGContext/restoreGState()> function to restore the previous graphics state.

This function may be called from any thread of your app.

---

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)