The working set is your mechanism to notify FileProvider of remote changes to your files. It should include, at a minimum, all of the items in the materializedSet, plus the direct children of any directories in the materialized set (since those will have dataless placeholders on disk). The implementation is up to you.
I’m not sure I understand your second question. As a general principle, you should not be touching the files in the user visible storage location (in ~/Library/CloudStorage/yourApp-yourDomain).
- The system enumerates directories from your extension, and places them on disk in the user visible storage on your behalf.
- The system calls fetchContents to populate dataless files on demand. You should write the download file into a temporary directory, and give the system the URL on the completion handler. The system handles transferring the contents to the user visible storage.
I recommend reading the header files in the FileProvider framework, there are detailed header comments.