Swiftpack.co - aplr/Timekeeper as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by aplr.
aplr/Timekeeper 0.0.2
A time measurement library for iOS, tvOS, watchOS and macOS, written in Swift.
⭐️ 1
🕓 30 weeks ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/aplr/Timekeeper.git", from: "0.0.2")

Timekeeper

Build Documentation

Timekeeper is an easy-to-use time measurement library written in Swift, with support for iOS, tvOS, watchOS and macOS.

Installation

Timekeeper is available via the Swift Package Manager which is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system and automates the process of downloading, compiling, and linking dependencies.

Once you have your Swift package set up, adding Timekeeper as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .package(
        url: "https://github.com/aplr/Timekeeper.git",
        .upToNextMajor(from: "0.0.1")
    )
]

Usage

import Timekeeper

// Start a new timing
Timekeeper.shared.start("measurement")

// Print the elapsed time since start
Timekeeper.shared.lap(print: "measurement")

// Print the elapsed time since the last lap
Timekeeper.shared.lap(print: "measurement")

// Print the elapsed time since the last lap and start and clears the timing
Timekeeper.shared.stop(print: "measurement")
// Start a new timing
Timekeeper.shared.start("measurement")

// Add a new lap and return the timing
let measurement = Timekeeper.shared.lap("measurement")

// Stop the timer and return the timing
let measurement = Timekeeper.shared.stop("measurement")

Documentation

Documentation is available here and provides a comprehensive documentation of the library's public interface.

License

Timekeeper is licensed under the MIT License.

GitHub

link
Stars: 1
Last commit: 30 weeks ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Related Packages

Release Notes

Timekeeper 0.0.2
30 weeks ago

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