Swiftpack.co -  blackbeltlabs/SwiftDirectoryWatcher as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
blackbeltlabs/SwiftDirectoryWatcher
Directory watcher for iOS and macOS written in Swift.
.package(url: "https://github.com/blackbeltlabs/SwiftDirectoryWatcher.git", from: "1.0.0")

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: 2
Last commit: 5 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

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