Tracking Your File Provider’s Changes
Create an enumerator to track changes to your file provider’s content.
Overview
While an enumerator is active, it also tracks any changes to its contents. The system only tracks changes to a document or folder while it has an active enumerator for that item (for example, while a document is open or a folder is being browsed).
[Image]
When your file provider app or extension identifies a change to its content:
Call the NSFileProviderManager class’s signalEnumerator(for:completionHandler:) method to notify the system of the change. Pass the item’s identifier as the
containerItemIdentifierproperty.If the change affects the working set, call signalEnumerator(for:completionHandler:) a second time. Pass the workingSet constant as the
containerItemIdentifierproperty. This tells the system to update the working set.
After the system is alerted to the change, it calls enumerateChanges(for:from:) on any affected, active enumerations and updates the browser’s user interface as needed. This method is asynchronous. When it’s called, the enumerator gathers information about the items (perhaps from a remote server) in the background, and returns the results to the specified observer (an object that adopts the NSFileProviderChangeObserver protocol).