Swiftpack.co - Package - bscothern/Once

Once

GitHub license Carthage compatibleSPM

A simple thread safe replacement for Dispatch Once and pthread_once for Swift.

Carthage Usage

Include this line in your Cartfile:

github "bscothern/Once"

Swift Package Manager

Update your Package.swift to include this to your package dependencies:

.package(url: "https://github.com/bscothern/Once.git", from: "1.3.0")

Usage

import Once

let once = Once()

func foo() {
    once.runOnce {
        // Do stuff that should only execute the first time foo() is called.
    }
    // Do stuff
}

Github

link
Stars: 1
Help us keep the lights on

Dependencies

Used By

Total: 0

Releases

v1.3.0 - May 9, 2018

Linux Support

v1.2.0 - Apr 13, 2018

Simplified use of C module, includes, etc.

v1.1.0 - Mar 22, 2018

Added SPM Support

v1.0.0 - Jan 25, 2018