renameDocument(at:proposedName:completionHandler:)
Renames a document at the specified URL.
Declaration
func renameDocument(at documentURL: URL, proposedName: String, completionHandler: @escaping (URL?, (any Error)?) -> Void)func renameDocument(at documentURL: URL, proposedName: String) async throws -> URLParameters
- documentURL:
The URL specifying the location of the document.
- proposedName:
The proposed new name to rename the document to. If
proposedNameis already taken, the system might alter the proposed name and confirm the new suggestion with the user. The final name that the system chooses appears in thefinalURLparameter ofcompletionHandler. - completionHandler:
A completion handler to execute after the renaming operation occurs. The final URL and error information are available in the completion handler.
finalURLThe URL of the newly renamed document, or
nilif an error occurs.errorAn object that describes the error, if one occurs; otherwise,
nil.