Class

NSFileProviderExtension

The principal class for the File Provider extension.

Declaration

class NSFileProviderExtension : NSObject

Overview

To create a File Provider extension, subclass this class and override all of its methods. When implementing your NSFileProviderExtension subclass, remember:

  • You must override all of the extension's methods (except the deprecated methods), even if your implementation is only an empty method.

  • Use these methods to provide access to the documents and folders managed by your file provider.

  • Don't call super in your method implementations.

Topics

Working with Items and Persistent Identifiers

func persistentIdentifierForItem(at: URL) -> NSFileProviderItemIdentifier?

Returns a unique identifier for the given URL.

Deprecated
func urlForItem(withPersistentIdentifier: NSFileProviderItemIdentifier) -> URL?

Returns the URL for a given persistent identifier.

Deprecated
func item(for: NSFileProviderItemIdentifier) -> NSFileProviderItem

Returns a description of the item associated with the persistent identifier.

struct NSFileProviderItemIdentifier

A unique identifier for an item managed by the File Provider extension.

Managing Shared Files

func itemChanged(at: URL)

Tells the File Provider extension that a document has changed.

Deprecated
func providePlaceholder(at: URL, completionHandler: (Error?) -> Void)

Triggers the creation of a placeholder for the given URL.

Deprecated
func startProvidingItem(at: URL, completionHandler: (Error?) -> Void)

Provides an actual file on disk for a placeholder.

Deprecated
func stopProvidingItem(at: URL)

Tells the File Provider extension that a given document is no longer being accessed.

Deprecated

Handling Actions

Providing Support for User-Driven Actions

Override methods to handle user-initiated actions.

Managing Domains

var domain: NSFileProviderDomain?

The domain managed by this file provider object.

Working with Services

func supportedServiceSources(for: NSFileProviderItemIdentifier) -> [NSFileProviderServiceSource]

Return an array of service sources that let the host app perform actions associated with the specified item.

protocol NSFileProviderServiceSource

A service that provides a custom communication channel between the host app and the File Provider extension.

Managing Placeholders

These methods have been deprecated and moved to the NSFileProviderManager class.

class func placeholderURL(for: URL) -> URL

Returns a placeholder URL for a given document URL.

Deprecated
class func writePlaceholder(at: URL, withMetadata: [URLResourceKey : Any])

Writes a document placeholder with the provided metadata.

Deprecated

Accessing the Document Storage

These methods have been deprecated and moved to the NSFileProviderManager class.

var documentStorageURL: URL

The root URL for all shared documents.

Deprecated
var providerIdentifier: String

A purpose identifier for coordinated reads and writes.

Deprecated

Relationships

Inherits From

Conforms To

See Also

First Steps

class NSFileProviderManager

A manager object that you use to communicate with the file provider from either your app or your File Provider extension.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software