This just gets more and more confusing.
Let me state what the situation is…
Unlike a normal Folder; a Smart folder relies on NSMetadataQueryDidFinishGathering and NSMetadataQueryDidUpdate notifications, sent from the default NotificationCenter.
The handling closure receives a notification object, which contains an array of all URLs that match the query's predicate. It is these URLs that need to be passed to a "buffer", to be returned by the fileURLs property on demand from a CollectionView.
The updating notifications only happen as a result of a user manually deleting or adding files to a folder, so it's hardly a time-critical operation.
Once the notification handler has assigned the changed URLs to the "buffer", it then posts a message to the default NotificationCenter, which is caught by the UI and provokes a refresh of the CollectionView, which then reads the "buffer" via the fileURLs property, in the same way as it would read a static list of URLs in a normal folder.
in other words, the rest of the app's code should know absolutely nothing about how the URLs are supplied, hence the protocol.
The code I have for the ThreadsafeVar works fine but, with all the hype about actors and isolation, I was trying to see if I could make it work in this situation.
Or is all this new stuff a solution looking for a problem?