close(completionHandler:)
Asynchronously closes the document after saving any changes.
Declaration
func close(completionHandler: (@Sendable (Bool) -> Void)? = nil)func close() async -> BoolParameters
Discussion
You call this method to begin the sequence of method calls that saves a document safely and asynchronously. The file-system location of the document derives from the fileURL property. After the save operation concludes, the code in completionHandler is executed. In this code, you can close the document — for example, by removing the document’s view from the screen. Additionally, if the save operation didn’t succeed (success is false), you can respond in an appropriate manner.
You typically wouldn’t override this method. The default implementation calls the autosave(completionHandler:) method.