write(to:ofType:)
Writes the contents of the document to a file or file package located by a URL, that is formatted to a specified type.
Declaration
nonisolated func write(to url: URL, ofType typeName: String) throwsParameters
- url:
The location to which the document contents are written.
- typeName:
The string that identifies the document type.
Discussion
The default implementation of this method just invokes [self fileWrapperOfType:typeName error:outError] and writes the returned file wrapper to disk.
For backward binary compatibility with OS X v10.3 and earlier, the default implementation of this method instead invokes [self writeToFile:[absoluteURL path] ofType:typeName] if writeToFile:ofType: is overridden and the URL uses the file: scheme.
See Also
Writing the Document’s Content
canAsynchronouslyWrite(to:ofType:for:)unblockUserInteraction()writeSafely(to:ofType:for:)fileWrapper(ofType:)data(ofType:)write(to:ofType:for:originalContentsURL:)save(to:ofType:for:delegate:didSave:contextInfo:)save(to:ofType:for:completionHandler:)fileAttributesToWrite(to:ofType:for:originalContentsURL:)NSDocument.SaveOperationType