---
title: "clip(to:style:options:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/graphicscontext/clip(to:style:options:)"
---

# clip(to:style:options:)

Adds a path to the context’s array of clip shapes.

## Declaration

```swift
mutating func clip(to path: Path, style: FillStyle = FillStyle(), options: GraphicsContext.ClipOptions = ClipOptions())
```

## Parameters

- `path`: A doc://com.apple.SwiftUI/documentation/SwiftUI/Path that defines the shape of the clipping mask.
- `style`: A doc://com.apple.SwiftUI/documentation/SwiftUI/FillStyle that defines how to rasterize the shape.
- `options`: Clip options that tell SwiftUI how to interpret the path as a clip shape. For example, you can invert the clip shape by setting the doc://com.apple.SwiftUI/documentation/SwiftUI/GraphicsContext/ClipOptions/inverse option.

## Discussion

Discussion Call this method to add a shape to the array of clip shapes that the context uses to define a clipping mask. Shapes that you add affect only subsequent drawing operations.

## See Also

### Masking

- [clipToLayer(opacity:options:content:)](swiftui/graphicscontext/cliptolayer(opacity:options:content:).md)
- [clipBoundingRect](swiftui/graphicscontext/clipboundingrect.md)
- [GraphicsContext.ClipOptions](swiftui/graphicscontext/clipoptions.md)
