Latest 1.1.0
Homepage https://github.com/GianniCarlo/DirectoryWatcher
License MIT
Platforms ios 10.0
Authors

This is a Swift translation of the Objective C version. Took some inspiration from this repo as well

DirectoryWatcher is a lightweight class that uses GCD to monitor a given path for changes.
When any change to the directory occurs, DirectoryWatcher starts polling the monitored path, making sure that file transfers are finished before posting notifications.

Installing

CocoaPods (recommended)

# For latest release in cocoapods
pod 'DirectoryWatcher'

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate DirectoryWatcher into your Xcode project using Carthage, specify it in your Cartfile:

github "GianniCarlo/DirectoryWatcher" ~> 1.0.0

Run carthage update to build the framework and drag the built DirectoryWatcher.framework into your Xcode project.

Usage

Monitor the Documents Folder

let documentsUrl = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
let watcher = DirectoryWatcher.watch(documentsUrl) {
  // A file has been added to or removed from the folder
}

Call watcher.stopWatching() and watcher.startWatching() to pause / resume.

Latest podspec

{
    "name": "DirectoryWatcher",
    "version": "1.1.0",
    "summary": "Lightweight listener that uses GCD to monitor changes in a given folder",
    "description": "DirectoryWatcher is a lightweight class that uses GCD to monitor a given path for changes. When any change to the directory occurs, DirectoryWatcher starts polling the monitored path, making sure that file transfers are finished before posting notifications.",
    "homepage": "https://github.com/GianniCarlo/DirectoryWatcher",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Gianni Carlo": "[email protected]"
    },
    "platforms": {
        "ios": "10.0"
    },
    "swift_version": "4.1",
    "source": {
        "git": "https://github.com/GianniCarlo/DirectoryWatcher.git",
        "tag": "1.1.0"
    },
    "source_files": "DirectoryWatcher/**/*.{h,swift}"
}

Pin It on Pinterest

Share This