Fork me on GitHub

Download the project

Zip file download Tar file download

CDEvents by rastersize

CDEvents is an Objective-C wrapper for Mac OS X’s FSEvents C API with support for blocks. Furthermore, all the classes are immutable.

Usage

  1. Add CDEvents to your project,
  2. Import the CDEvents.h header where you need it.
  3. Set up your CDEvents instance and give it a block to execute when a event occurs.

Short example which will print each event:

#import <CDEvents/CDEvents.h>

...

NSArray *url  = [NSURL URLWithString:@"/path/to/directory"];
NSArray *urls = [NSArray arrayWithObject:url];
self.events   = [[CDEvents alloc] initWithURLs:urls block:
                    ^(CDEvents *watcher, CDEvent *event) {
                        NSLog(
                            @"URLWatcher: %@\nEvent: %@",
                            watcher,
                            event
                        );
	            }];

For a more complete example of usage please see the example application CDEventsTestApp target in the CDEvents Xcode project. You might also want to check out the API documentation.

Documentation

View the index of API documentation for all version of CDEvents or go directly to API documentation for the latest version of CDEvents. Now and then the API documentation for HEAD is also updated. You can always create the documentation by running the api.appledoc.sh script from the root of the project

Requirements

Requires Mac OS X 10.6 (Snow Leopard) and an Intel 64-bit CPU. The requirements stems from that automatic reference counting (ARC) is supported from 10.6 and up as long as the modern (i.e. 64-bit) Objective-C runtime is used since ARC requires the non-fragile ABI. Although the built product works on 10.6 and up it must be built on a machine running 10.7 (Lion) using Xcode 4.2 and the 10.7 SDK as the 10.6 SDK does not include ARC. The built product support both manual memory management and automatic reference counting.

If you need to support older versions of OS X or garbage collection please see the branch support/1.1 All 1.1.x version will support garbage collection and OS X 10.5.

Author

Aron Cedercrantz (aron@[my last name].se).

Download

You can download this project in either zip or tar formats.

You can also clone the project with Git by running:

$ git clone git://github.com/rastersize/CDEvents

License

CDEvents is licensed under the MIT license (the Expat version). See the LICENSE file in the project root for the full text.