---
title: "setPurgeableState(_:)"
framework: metal
role: symbol
role_heading: Instance Method
path: "metal/mtlheap/setpurgeablestate(_:)"
---

# setPurgeableState(_:)

Sets the purgeable state of the heap.

## Declaration

```swift
func setPurgeableState(_ state: MTLPurgeableState) -> MTLPurgeableState
```

## Parameters

- `state`: The desired purgeable state of the heap.

## Return Value

Return Value The previous purgeable state of the heap.

## Discussion

Discussion The heap purgeability state refers to its whole backing memory and affects all resources in the heap. Heaps can be marked purgeable but its resources cannot; the heap’s resources always reflect the heap’s purgeability state. Refer to the MTLPurgeableState and setPurgeableState(_:) reference for further information.
