---
title: "updateChangeCount(withToken:for:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsdocument/updatechangecount(withtoken:for:)"
---

# updateChangeCount(withToken:for:)

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

## Declaration

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

## Parameters

- `changeCountToken`: An object encapsulating the document changes, returned from doc://com.apple.appkit/documentation/AppKit/NSDocument/changeCountToken(for:).
- `saveOperation`: The type of save operation.

## Discussion

Discussion This method updates the values in the isDocumentEdited and hasUnautosavedChanges properties. For example, 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(_:) messages when appropriate.

## See Also

### Updating the Document Change Count

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