Swiftpack.co - mezhevikin/Measure as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by mezhevikin.
mezhevikin/Measure 0.0.1
⏲ A tiny package to measure code execution time. Only 20 lines of code.
⭐️ 3
🕓 1 week ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/mezhevikin/Measure.git", from: "0.0.1")

Measure

⏲ A tiny package to measure code execution time.

Measure.start("create-user")
let user = User()
Measure.finish("create-user")

Console

// ⏲ Measure [create-user]: 0.00521 sec.

Measure async request

Measure.start("request")
let url = URL(string: "https://httpbin.org/get")!
URLSession.shared.dataTask(with: url) { _, _, _ in
    let time = Measure.finish("request")
    Analytics.send(event: "request", ["time" => time])
}.resume()

Swift Package Manager

https://github.com/mezhevikin/Measure.git

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