previewController(_:didSaveEditedCopyOf:at:)
Tells the delegate that the preview item’s edited content was successfully saved to a copy at the given URL.
Declaration
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
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
previewItemis QLPreviewItemEditingMode.createCopy.The editing mode of the
previewItemis QLPreviewItemEditingMode.updateContents and the system can’t overwrite its previewItemURL. In this case,modifiedContentsURLpoints 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
modifiedContentsURLmay 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.