---
title: "clamp(to:)"
framework: spatial
role: symbol
role_heading: Instance Method
path: "spatial/clampablewithinrectprotocol/clamp(to:)"
---

# clamp(to:)

Clamps the mutable entity to the specified rectangle.

## Declaration

```swift
mutating func clamp(to rect: Self.Rect)
```

## Parameters

- `rect`: The rectangle that defines the clamp volume.
