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

# updateChangeCount(withToken:for:)

Updates the document’s change count settings after a successful save operation.

```
func updateChangeCount(withToken changeCountToken: Any, for saveOperation: NSDocument.SaveOperationType)
```

## Parameters

`changeCountToken`

An object encapsulating the document changes, returned from [`changeCountToken(for:)`](/documentation/AppKit/NSDocument/changeCountToken(for:)).

`saveOperation`

The type of save operation.

## Discussion

This method updates the values in the [`isDocumentEdited`](/documentation/AppKit/NSDocument/isDocumentEdited) and [`hasUnautosavedChanges`](/documentation/AppKit/NSDocument/hasUnautosavedChanges) properties. For example, [`save(to:ofType:for:completionHandler:)`](/documentation/AppKit/NSDocument/save(to:ofType:for:completionHandler:)) invokes this method, on the main thread, when it is done saving. The default implementation of this method also sends all of the document’s window controllers [`setDocumentEdited(_:)`](/documentation/AppKit/NSWindowController/setDocumentEdited(_:)) messages when appropriate.

---

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)