---
title: discardContentIfPossible()
framework: foundation
role: symbol
role_heading: Instance Method
path: foundation/nsdiscardablecontent/discardcontentifpossible()
---

# discardContentIfPossible()

Called to discard the contents of the receiver if the value of the accessed counter is 0.

## Declaration

```swift
func discardContentIfPossible()
```

## Discussion

Discussion This method should only discard the contents of the object if the value of the accessed counter is 0. Otherwise, it should do nothing.

## See Also

### Discarding Content

- [isContentDiscarded()](foundation/nsdiscardablecontent/iscontentdiscarded().md)
