Instance Property

savingFileType

Returns the file type to use for saving a document.

Declaration

var savingFileType: String? { get }

Return Value

A Uniform Type Identifier (UTI) identifying a document type (for example, PDF or HTML).

Discussion

The default implementation returns the current file type obtained from the fileType property. The default implementation of the save(to:for:completionHandler:) method appends an extension to the file URL that is based on the file type. So if you want to move the document to a new type and extension, you can override this method to supply that file type.

See Also

Writing Document Data

func close(completionHandler: ((Bool) -> Void)? = nil)

Asynchronously closes the document after saving any changes.

func contents(forType: String)

Override this method to return the document data to be saved.

func save(to: URL, for: UIDocumentSaveOperation, completionHandler: ((Bool) -> Void)? = nil)

Saves document data to the specified location in the application sandbox.

func writeContents(Any, andAttributes: [AnyHashable : Any]? = nil, safelyTo: URL, for: UIDocumentSaveOperation)

Ensures that document data is written safely to a specified location in the application sandbox.

func writeContents(Any, to: URL, for: UIDocumentSaveOperation, originalContentsURL: URL?)

Writes the document data to disk at the sandbox location indicated by a file URL.

func fileAttributesToWrite(to: URL, for: UIDocumentSaveOperation)

Returns a dictionary of file attributes to associate with the document file when writing or updating it.

func fileNameExtension(forType: String?, saveOperation: UIDocumentSaveOperation)

Returns a file extension to append to the file URL of the document file being written.