---
title: "savePresentedItemChanges(completionHandler:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsfilepresenter/savepresenteditemchanges(completionhandler:)"
---

# savePresentedItemChanges(completionHandler:)

Tells your object to save any unsaved changes for the presented item.

## Declaration

```swift
optional func savePresentedItemChanges(completionHandler: @escaping @Sendable ((any Error)?) -> Void)
```

```swift
optional func savePresentedItemChanges() async throws
```

## Parameters

- `completionHandler`: The https://developer.apple.com/library/archive/documentation/General/Conceptual/DevPedia-CocoaCore/Block.html#//apple_ref/doc/uid/TP40008195-CH3 to call after you save your changes. If you saved your changes successfully, pass nil for the block’s errorOrNil parameter; otherwise, pass an error object indicating why the changes could not be saved.

## Discussion

Discussion The file coordinator calls this method to ensure that all objects trying to access the file or directory see the same contents. Implement this method if your object can change the presented item in a way that requires you to write those changes back to disk. If your presenter object does not make changes that need to be saved, you do not need to implement this method. important: If you implement this method, you must execute the block in the completionHandler parameter at the end of your implementation. The system waits for you to execute that block before allowing other objects to operate on the file. Therefore, failure to execute the block could stall threads in your application or other processes.

## See Also

### Handling Changes to Files

- [accommodatePresentedItemDeletion(completionHandler:)](foundation/nsfilepresenter/accommodatepresenteditemdeletion(completionhandler:).md)
- [presentedItemDidMove(to:)](foundation/nsfilepresenter/presenteditemdidmove(to:).md)
- [presentedItemDidChange()](foundation/nsfilepresenter/presenteditemdidchange().md)
