---
title: "changeCountToken(for:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsdocument/changecounttoken(for:)"
---

# changeCountToken(for:)

Returns an object that encapsulates the current record of document changes at the beginning of a save operation.

## Declaration

```swift
func changeCountToken(for saveOperation: NSDocument.SaveOperationType) -> Any
```

## Parameters

- `saveOperation`: The type of save operation.

## Return Value

Return Value An object encapsulating the document changes.

## Discussion

Discussion The returned object is meant to be passed to updateChangeCount(withToken:for:) at the end of the save operation. For example, save(to:ofType:for:completionHandler:) invokes this method, on the main thread, before it does any actual saving. This method facilitates asynchronous saving, during which a user can change a document while it is being saved.

## See Also

### Updating the Document Change Count

- [updateChangeCount(withToken:for:)](appkit/nsdocument/updatechangecount(withtoken:for:).md)
- [updateChangeCount(_:)](appkit/nsdocument/updatechangecount(_:).md)
- [NSDocument.ChangeType](appkit/nsdocument/changetype.md)
