---
title: clearStencil
framework: metalkit
role: symbol
role_heading: Instance Property
path: metalkit/mtkview/clearstencil
---

# clearStencil

The stencil value to use to clear the stencil target when creating a render pass descriptor.

## Declaration

```swift
var clearStencil: UInt32 { get set }
```

## Discussion

Discussion If you specified that you want a stencil texture, the view configures any render passes to use the stencil texture, with a load action of MTLLoadAction.clear and the value of this property as the value to clear it to. The default value is 0.

## See Also

### Configuring the Render Target Properties

- [depthStencilPixelFormat](metalkit/mtkview/depthstencilpixelformat.md)
- [depthStencilAttachmentTextureUsage](metalkit/mtkview/depthstencilattachmenttextureusage.md)
- [clearDepth](metalkit/mtkview/cleardepth.md)
