Simple FSEvents wrapper for Swift
- Add
github "soh335/FileWatch"
to your Cartfile. - Run
carthage update
. - Add FileWatch.framework to Embedded Binaries.
import FileWatch
let filewatch = try! FileWatch(paths: ["/path/to/dir"], createFlag: [.UseCFTypes, .FileEvents], runLoop: RunLoop.current, latency: 3.0, eventHandler: { event in
if event.flag.contains(.ItemIsFile) {
debugPrint(event.path)
}
})
- MIT