Latest 0.0.6
Homepage https://github.com/mirkokiefer/SwiftDirectoryWatcher
License MIT
Platforms ios 11.0, osx 10.13
Authors

Swift DirectoryWatcher

Build Status

Directory watcher for iOS and macOS written in Swift.

Usage

Example:

import DirectoryWatcher

class ViewController: UIViewController {
  lazy var url = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
  lazy var watcher = DirectoryWatcher(url: url)

  override func viewDidLoad() {
    super.viewDidLoad()

    watcher.delegate = self
  }
}

extension ViewController: DirectoryWatcherDelegate {
  func directoryWatcher(_ watcher: DirectoryWatcher, changed: DirectoryChangeSet) {
    print("new files (changed.newFiles), deleted files (changed.deletedFiles)")
  }
}

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate DirectoryWatcher into your Xcode project using CocoaPods, specify it in your Podfile:

pod 'DirectoryWatcher', '~> 0.0.4'

Manually

If you prefer not to use any of the aforementioned dependency managers, you can integrate DirectoryWatcher into your project manually.

Embedded Framework

Download this repository into a folder at the same level of your project folder.
From your Xcode project drag the DirectoryWatcher.xcodeproj file into your project at the top level.

In your project target scroll down to the Embedded Binaries setting and drag DirectoryWatcher.framework from DirectoryWatcher.xcodeproj/Products. The top framework is for macOS, the bottom one is for iOS (they are name identically).

Build your project and you are good to go.

Latest podspec

{
    "name": "SwiftDirectoryWatcher",
    "version": "0.0.6",
    "summary": "Directory watcher for iOS and macOS written in Swift.",
    "description": "A delegate-based directory watcher written in Swift.nThe module handles the identification of created and deleted files by diffing the folder content.",
    "homepage": "https://github.com/mirkokiefer/SwiftDirectoryWatcher",
    "license": "MIT",
    "authors": {
        "Mirko Kiefer": "[email protected]"
    },
    "swift_version": "4.2",
    "platforms": {
        "ios": "11.0",
        "osx": "10.13"
    },
    "source": {
        "git": "https://github.com/mirkokiefer/SwiftDirectoryWatcher.git",
        "tag": "0.0.6"
    },
    "source_files": "Source/*.swift"
}

Pin It on Pinterest

Share This