NSFileProviderEnumerator Invalidation

Hello,

I've been implementing a FileProvider to work with the Files app, And I'm having problems with the NSFileProviderEnumerator Invalidation timing;

It seems that every time I'm going a step deeper into the folder tree, the Enumerator of the previous folder invalidates. Then, If I do an action in the new folder (Rename for example), and the returning to the previous folder, it seems empty (assuming because the NSFileProviderEnumerator for that folder is already invalid). When I go up one folder, and returning down, the NSFileProviderEnumerator is recreated and the folder shows properly.


I saw an example, where the NSFileProviderEnumerator invalidates for a folder only when the current folder is in a distance of 2 levels deeper, but I couldn't understand how they did it.


I'de appreciate any input on the matter.


Thanks,

Hanan