An Objective-C wrapper for Mac OS X’s FSEvents C API.
Name | Size | Rev. | Time | Author | Log Message |
---|---|---|---|---|---|
CDEvents.xcodeproj | |||||
English.lproj | |||||
TestApp | |||||
.gitattributes | 31 | d95574b | 2011-10-25 06:05:05 | Aron Cedercrantz | Change project settings. - Cleanup o... |
.gitignore | 283 | 3a4ae54 | 2011-11-03 00:53:34 | Aron Cedercrantz | Ignore "docs" directory. |
CDEvent.h | 13.22 k | 88c6487 | 2013-07-03 05:17:39 | Aron Cedercrantz | Merge branch 'develop' of https://git... |
CDEvent.m | 4.92 k | ad660ce | 2014-02-21 07:18:40 | Krzysztof Adamski | Pass unisgnedIntValue Instead of unsi... |
CDEvents.h | 17.33 k | 88c6487 | 2013-07-03 05:17:39 | Aron Cedercrantz | Merge branch 'develop' of https://git... |
CDEvents.m | 10.84 k | 91e7662 | 2014-02-21 07:17:27 | Krzysztof Adamski | Pass CDEventsEventStreamCreationFlags... |
CDEvents.podspec | 521 | b0e852c | 2013-07-03 05:12:26 | Aron Cedercrantz | Update podspec to 1.2.1. Signed-off-... |
CDEventsDelegate.h | 2.21 k | 453dfcc | 2013-07-03 05:06:48 | Aron Cedercrantz | Bump copyright year. Signed-off-by: ... |
CDEventsTestApp-Info.plist | 895 | 963b07a | 2010-04-10 10:18:53 | Aron Cedercrantz | Changed the formatting of the API doc... |
CDEvents_Prefix.pch | 158 | 963b07a | 2010-04-10 10:18:53 | Aron Cedercrantz | Changed the formatting of the API doc... |
Info.plist | 861 | acd2910 | 2014-02-25 04:49:51 | Aron Cedercrantz | Bump version to 1.2.2. |
LICENSE | 1.04 k | 694b652 | 2011-11-02 22:41:00 | Aron Cedercrantz | Add license file. |
README.mdown | 6.07 k | dc72057 | 2013-05-16 15:36:23 | Tomoki Aonuma | Fix whitespace. |
api.appledoc.sh | 1024 | beb5d71 | 2011-11-02 22:40:30 | Aron Cedercrantz | Add script to generate documentation ... |
api.doxygen | 61.99 k | 3417cae | 2010-07-16 08:17:45 | Aron Cedercrantz | Added Doxygen configuration file. |
compat.h | 2.71 k | 453dfcc | 2013-07-03 05:06:48 | Aron Cedercrantz | Bump copyright year. Signed-off-by: ... |
version.plist | 461 | 963b07a | 2010-04-10 10:18:53 | Aron Cedercrantz | Changed the formatting of the API doc... |
Note: The develop
branch requires Mac OS X 10.6 or newer as the framework relies on ARC and blocks.
Website: http://rastersize.github.com/CDEvents
It's an Objective-C wrapper for Mac OS X's FSEvents C API with support for blocks. Furthermore, all the classes are immutable and it should be thread-safe.
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.
You can use either the block based version (recommended) or the delegate based. Using both systems at the same time is not supported.
CDEvents.framework
into your project orCDEvents.h
header where you need it.CDEvents
instance and give it a block to execute when a event occurs.Easy example code:
self.events = [[CDEvents alloc] initWithURLs:<NSArray of URLs to watch>
block:^(CDEvents *watcher, CDEvent *event) {
<Your code here>
}];
Or use all the all-options initiator:
self.events = [[CDEvents alloc] initWithURLs:<NSArray of URLs to watch>
block:^(CDEvents *watcher, CDEvent *event) {
<Your code here>
}
onRunLoop:[NSRunLoop currentRunLoop]
sinceEventIdentifier:kCDEventsSinceEventNow
notificationLantency:CD_EVENTS_DEFAULT_NOTIFICATION_LATENCY
ignoreEventsFromSubDirs:CD_EVENTS_DEFAULT_IGNORE_EVENT_FROM_SUB_DIRS
excludeURLs:<NSArray of URLs to exlude>
streamCreationFlags:kCDEventsDefaultEventStreamFlags];
See the test app (TestApp
) for an example on how to use the framework.
This is the same behavior as pre ARC and blocks.
CDEvents.framework
into your project orCDEvents.h
header where you need it.CDEventsDelegate.h
header where you need it (i.e. in the file which declares your delegate).-URLWatcher:eventOccurred:
) and create your CDEvents
instance.Example code:
self.events = [[CDEvents alloc] initWithURLs:<NSArray of URLs to watch>
delegate:<Your delegate>
onRunLoop:[NSRunLoop currentRunLoop]
sinceEventIdentifier:kCDEventsSinceEventNow
notificationLantency:CD_EVENTS_DEFAULT_NOTIFICATION_LATENCY
ignoreEventsFromSubDirs:CD_EVENTS_DEFAULT_IGNORE_EVENT_FROM_SUB_DIRS
excludeURLs:<NSArray of URLs to exlude>
streamCreationFlags:kCDEventsDefaultEventStreamFlags];
See the test app (TestApp
) for an example on how to use the framework.
Important: Since Mac OS X 10.6 is set as the deployment target automatic zeroing of weak references is not available. Thus you must set the delegate
of CDEvents
to nil
when you no longer want to receive events. That is, at least in your -dealloc
method. This is also required when using 10.7 and up! (delegate
is an unsafe_unretained
property.)
For more details please refer to the documentation in the header files and the section "API documentation" below.
Read the latest API documentation or browse for each version of CDEvents. Alternatively you can generate it yourself, please see below.
Run the script api.appledoc.sh
from the root of the project. The script takes one optional argument, the version of the project as a string. If the version string is empty "HEAD" will be used instead.
You can generate API documentation with the help of Doxygen. In Doxygen open the file api.doxygen
, click the Run
tab and then the Run doxygen
button. When it's done you should have a directory (ignored by git) in the root of the project named api
with a sub-directory html
in which you will find index.html
double-click and enjoy.
See GitHubs contributors to rastersize/CDEvents statistics page.
The code is released under the MIT-license.
If you want, even though you really don't have to, I would love to hear what you use CDEvents for! Send me an email (first name (i.e. aron) @ last name (i.e. cedercrantz) dot se).