0

I'm trying to integrate UKKQueue into a Cocoa application. I've downloaded the 8 files from the repository, and added them into my Xcode project.

However, I'm not sure how to use a UKKQueue in my Cocoa application. What do I need to do next to use a UKKQueue?

Brad Larson
  • 170,088
  • 45
  • 397
  • 571
Bhushan
  • 23
  • 2

1 Answers1

2

Start by looking at the readme file, which says:

Simply create a UKKQueue (or use the singleton), add a few paths to it and listen to the change notifications via NSWorkspace's notification center

After that, the code is essentially self-documenting, so the thing to do is look at the header files and see what they tell you. The main file is UKKQueue.h, and here we find the UKKQueue object and a list of its public methods and properties. It also adopts the UKFileWatcher protocol, so look at UKFileWatcher.h for more methods you can use when talking to a UKKQueue object.

So, as the readme file said, first #import "UKKQueue.h" into your own code file, and then instantiate UKKQueue. (Obviously, you need to retain that instance somewhere.) It has a delegate, so adopt the delegate protocol UKFileWatcherDelegate and set yourself as that instance's delegate. Now addPath: on the instance, just as the readme file told you to.

You've implemented watcher:receivedNotification:forPath: (because you are the delegate), so now just sit back and wait for notifications to arrive. The headers tell you what notifications to expect.

That's all there is to it. Notice that I was able to say all that without ever having used any of these files; I've never seen any of these files before in my life. It's just a matter of looking at the readme and the headers (and knowing Objective-C and the standard patterns, of course). If you can't do that, then you need to learn Objective-C before trying this sort of thing on your own.

matt
  • 515,959
  • 87
  • 875
  • 1,141