Contents

startProvidingItem(at:completionHandler:)

Provides an actual file on disk for a placeholder.

Declaration

func startProvidingItem(at url: URL, completionHandler: @escaping  @Sendable ((any Error)?) -> Void)
func startProvidingItem(at url: URL) async throws

Parameters

  • url:

    The URL of a shared document.

  • completionHandler:

    A block to be called as soon as the file is available.

    The completion handler takes the following parameter:

    error

    If the document was produced, this value is nil. Otherwise, it holds an NSError object describing the error.

Discussion

This method is called whenever another process tries to access a placeholder for a shared document.

Override this method to download, create, or otherwise provide the file. As soon as the file is available, call the provided completion handler. If any errors occur during this process, pass the error to the completion handler. The system then passes the error back to the original coordinated read or write.

You must override this method. Do not call super in your implementations.

See Also

Managing shared files