Swiftpack.co - blackbeltlabs/SwiftDirectoryWatcher as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by blackbeltlabs.
blackbeltlabs/SwiftDirectoryWatcher 1.0.1
Directory watcher for iOS and macOS written in Swift.
⭐️ 7
🕓 1 year ago
macOS
.package(url: "https://github.com/blackbeltlabs/SwiftDirectoryWatcher.git", from: "1.0.1")

Swift DirectoryWatcher

CI Status Version License Platform

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.

GitHub

link
Stars: 7
Last commit: 1 year ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics