Swiftpack.co - Package - Ponyboy47/LockSmith


LockSmith is meant to be a system lock manager for swift executables.

By creating a LockSmith instance, you are locking down your current swift executable so that no other instance can be running. You also gain access to easy locking mechanisms for files and threads to help make you program thread-safe.


Installation can be done through the Swift Package Manager

Add the following line to your dependencies in you Package.swift file

.package(url: "https://github.com/Ponyboy47/LockSmith.git", from: "0.5.0")


In your main.swift:

import LockSmith

guard var processLock = LockSmith.singleton else {
    print("Another instance of your executable is already running")

// Your executable code here...

// This forces the destructor to be called, which unlocks any leftover locks (like the process lock)
processLock = nil

// the end

More examples later...




Stars: 0
Help us keep the lights on


0.3.0 - Jun 8, 2018

0.2.0 - Mar 16, 2018

Use PathKit instead of FileSmith

0.1.1 - Mar 16, 2018

Removed platform specific compiler flag

0.1.0 - Mar 16, 2018