"Your app is not alone with the files. Finder, Dropbox, iCloud, and Spotlight are all in the room. Coordinate, or collide."
The Files Belong to Everyone
It's tempting to write file code as if your app is the only thing touching the disk. It never is. While Waygate reads a folder, Finder might be renaming a file in it, a sync client might be writing a download, Spotlight might be indexing, and a cloud provider might be materializing a placeholder. If Waygate reads with no awareness of any of that, it can catch a file mid-write — a torn read — or race a sync client and corrupt the picture.
NSFileCoordinator Is the Handshake
macOS provides the mechanism for cooperating: NSFileCoordinator. Coordinating a read or write means announcing intent to the system so other coordinated actors — file providers, other coordinated apps — can pause, flush, or yield appropriately. When Waygate needs a consistent read of a file that a provider might be touching, it coordinates, so it sees a settled state rather than a half-applied change. This is correctness under concurrency, and it's why Waygate uses coordination where external state can change.
Presenters: Being a Good Citizen Back
Coordination goes both ways. Through NSFilePresenter, Waygate can also be notified when something it's displaying is about to change under it, so it can respond — re-enumerate, update a row, mark something offline. Being coordinated isn't only about protecting Waygate's own reads; it's about participating honestly in a shared filesystem so Waygate's projection stays in step with the truth other processes are editing.