Instance Method

performAsynchronousFileAccess(_:)

Schedules a document-reading or document-writing operation on a concurrent background queue.

Declaration

func performAsynchronousFileAccess(_ block: @escaping () -> Void)

Parameters

block

A block that is invoked as the task to execute on the background queue. The block returns no value and takes no parameters.

Discussion

A typical UIDocument subclasses—that is, one that overrides contents(forType:) and load(fromContents:ofType:)— does not need to call this method.

The default implementations of save(to:for:completionHandler:) and open(completionHandler:) call this method to serialize file access. If you override these methods and do not call super, you should call this method to serialize file access on a background queue. If you directly call the read(from:) method, you should wrap that call in the block passed into performAsynchronousFileAccess(_:).