item(for:)
Returns a description of the item associated with the persistent identifier.
Declaration
func item(for identifier: NSFileProviderItemIdentifier) throws -> NSFileProviderItemParameters
- identifier:
The persistent identifier for a shared document.
Return Value
A custom object that describes the specified document or directory, or nil in Objective-C if an error occurs.
Discussion
Your File Provider extension must define a class that adopts the NSFileProviderItemProtocol interface. Instances of this class provides access to information about an item (a document or directory) that your File Provider manages and stores.
Your class should implement as many of the protocol’s optional methods as makes sense for the specified item. This lets the system provide as much information as possible to the user as they browse your File Provider.
Optionally, you can define different classes for different types of items—for example, different classes for documents and directories. These classes can define different subsets of the NSFileProviderItemProtocol interface’s optional methods. For example, the class representing a folder implements the childItemCount property, while the class representing a document does not.
Override this method to look up the item associated with the persistent identifier and return an instance of your custom NSFileProviderItemProtocol class for that item.