<!--
{
  "availability" : [
    "macOS: 10.7.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSDocument/changeCountToken(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSDocument(im)changeCountTokenForSaveOperation:"
  },
  "title" : "changeCountToken(for:)"
}
-->

# changeCountToken(for:)

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

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

## Parameters

`saveOperation`

The type of save operation.

## Return Value

An object encapsulating the document changes.

## Discussion

The returned object is meant to be passed to [`updateChangeCount(withToken:for:)`](/documentation/AppKit/NSDocument/updateChangeCount(withToken:for:)) at the end of the save operation. For example, [`save(to:ofType:for:completionHandler:)`](/documentation/AppKit/NSDocument/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.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)