---
title: "clip(to:)"
framework: coregraphics
role: symbol
role_heading: Instance Method
path: "coregraphics/cgcontext/clip(to:)-7cbwq"
---

# clip(to:)

Sets the clipping path to the intersection of the current clipping path with the area defined by the specified rectangle.

## Declaration

```swift
func clip(to rect: CGRect)
```

## Parameters

- `rect`: The location and dimensions of the rectangle, in user space, to be used in determining the new clipping path.

## Discussion

Discussion This function sets the specified graphics context’s clipping region to the area which intersects both the current clipping path and the specified rectangle. After determining the new clipping path, the function resets the context’s current path to an empty path.

## See Also

### Working with the Current Clipping Path

- [clip(using:)](coregraphics/cgcontext/clip(using:).md)
- [clip(to:)](coregraphics/cgcontext/clip(to:)-2eg0.md)
- [clip(to:mask:)](coregraphics/cgcontext/clip(to:mask:).md)
- [boundingBoxOfClipPath](coregraphics/cgcontext/boundingboxofclippath.md)
