---
title: clearContents()
framework: appkit
role: symbol
role_heading: Instance Method
path: appkit/nspasteboard/clearcontents()
---

# clearContents()

Clears the existing contents of the pasteboard.

## Declaration

```swift
func clearContents() -> Int
```

## Return Value

Return Value The change count of the receiver.

## Discussion

Discussion Clears the existing contents of the pasteboard, preparing it for new contents. This is the first step in providing data on the pasteboard.

## See Also

### Writing data

- [writeObjects(_:)](appkit/nspasteboard/writeobjects(_:).md)
- [setData(_:forType:)](appkit/nspasteboard/setdata(_:fortype:).md)
- [setPropertyList(_:forType:)](appkit/nspasteboard/setpropertylist(_:fortype:).md)
- [setString(_:forType:)](appkit/nspasteboard/setstring(_:fortype:).md)
- [NSPasteboard.PasteboardType](appkit/nspasteboard/pasteboardtype.md)
