File change tracking on Mac in Swift

Is there any reasonable way to track file edits and closures in Swift on a Mac?

What I need:

  • (Completed) Open a file from the server (With default application - for example: MS Word for docx)
  • Track changes to the file, mainly OnChange, OnClose, and based on those, send commands and the file back to the server

What i tried:

  • I read forums.swift article and coresponding with this article also developer.apple.com and stackoverflow.com post. Everybody talks about the fact that it basically can't be done. At least not properly.
  • I tried to get some scripts from the AI, but that was also completely useless.

I currently want to try catching OnChange by displaying the resized file, and OnClose by using a file that creates a word and deletes it when closed. It's not an ideal solution, it's not even tested yet, but if we're primarily concerned with Word, Excel and PowerPoint, I don't currently have a better solution.

Is there any reasonable way to track file edits and closures in Swift on a Mac?

It depends on what you mean by “file”. Reading the rest of your post, it sounds like you’re asking about documents, not files. These are different things. While it is possible to track files being opened and closed on the Mac, that doesn’t help you much when it comes to documents.

This is a topic that’s come up many times here on DevForums, to the point that I wrote up the following: Inferring High-Level Semantics from Low-Level Operations. And, more specifically, there is this thread.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

File change tracking on Mac in Swift
 
 
Q