---
title: "previewController(_:didSaveEditedCopyOf:at:)"
framework: quicklook
role: symbol
role_heading: Instance Method
path: "quicklook/qlpreviewcontrollerdelegate/previewcontroller(_:didsaveeditedcopyof:at:)"
---

# previewController(_:didSaveEditedCopyOf:at:)

Tells the delegate that the preview item’s edited content was successfully saved to a copy at the given URL.

## Declaration

```swift
optional func previewController(_ controller: QLPreviewController, didSaveEditedCopyOf previewItem: any QLPreviewItem, at modifiedContentsURL: URL)
```

## Parameters

- `controller`: The controller that displays the preview.
- `previewItem`: The preview item for a file.
- `modifiedContentsURL`: A URL pointing to a temporary file that contains the edited version of the previewed file.

## Discussion

Discussion The platform invokes this callback with an edited copy of the preview item at modifiedContentsURL. It invokes the callback in the following scenarios: The editing mode of the previewItem is QLPreviewItemEditingMode.createCopy. The editing mode of the previewItem is QLPreviewItemEditingMode.updateContents and the system can’t overwrite its previewItemURL. In this case, modifiedContentsURL points to a temporary file on disk containing the edited copy. The editing mode of the preview item is QLPreviewItemEditingMode.updateContents and its content type doesn’t match the content type of the edited version. This mismatch means that the file type of the file at modifiedContentsURL may be different from the file type of the preview item. The platform may invoke the callback multiple times consecutively with the successive edited versions of the preview item. It typically invokes the callback once for each time the user saves their edits.

## See Also

### Editing the content of a preview

- [previewController(_:editingModeFor:)](quicklook/qlpreviewcontrollerdelegate/previewcontroller(_:editingmodefor:).md)
- [QLPreviewItemEditingMode](quicklook/qlpreviewitemeditingmode.md)
- [previewController(_:didUpdateContentsOf:)](quicklook/qlpreviewcontrollerdelegate/previewcontroller(_:didupdatecontentsof:).md)
