Swiftpack.co -  gergelysanta/Monitored as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
gergelysanta/Monitored
macOS framework for detecting when being monitored
.package(url: "https://github.com/gergelysanta/Monitored.git", from: "0.3.0")

Monitored is a macOS framework for detecting when you're being monitored. It detect state changes on camera and microphone devices.

Usage

Monitored provides a singleton object for monitoring events from camera and from microphones. Just set it up to delegate events to your object and start the watcher:

MonitoredWatcher.shared.delegate = self
MonitoredWatcher.shared.start()

You'll receive camera and microphone state reports through MonitoredDelegate delegate methods:

func cameraDevice(_ device: CameraDevice, stateChangedTo enabled: Bool) {
    NSLog("Camera: \(device.name) -> \(enabled ? "ON" : "OFF")")
}

func microphoneDevice(_ device: MicrophoneDevice, stateChangedTo enabled: Bool) {
    NSLog("Microphone: \(device.name) -> \(enabled ? "ON" : "OFF")")
}

Sandboxing

Sandboxed applications using Monitored.framework will need to enable the following entitlements:

  1. com.apple.security.device.camera for detecting camera devices
  2. com.apple.security.device.audio-input for detecting microphone devices

Installation

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 Monitored into your Xcode project using Carthage, specify it in your Cartfile:

github "gergelysanta/Monitored"

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

License

Monitored is released under the MIT License.
See LICENSE for details.

GitHub

link
Stars: 1
Last commit: 2 days 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