Swiftpack.co - std-swift/ULID as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by std-swift.
std-swift/ULID 1.0.1
Universally Unique Lexicographically Sortable Identifier
⭐️ 1
🕓 4 years ago
macOS
.package(url: "https://github.com/std-swift/ULID.git", from: "1.0.1")

ULID

Universally Unique Lexicographically Sortable Identifier

Importing

import ULID
platforms: [
	.macOS(.v10_12)
],
dependencies: [
	.package(url: "https://github.com/std-swift/ULID.git",
	         from: "1.0.0")
],
targets: [
	.target(
		name: "",
		dependencies: [
			"ULID"
		]),
]

Using

ULID

ULID conforms to Equatable, Comparable, Hashable, Codable, and LosslessStringConvertible

Initialize the raw data:

init(rawTime: (high: UInt32, low: UInt16), random: (UInt16, UInt32, UInt32))

Initialize with a Time and data

init(time: Time = Clock.realtime.now(), random: (Int) -> (UInt16, UInt32, UInt32))
init(time: Time = Clock.realtime.now(), random: @autoclosure () -> (UInt16, UInt32, UInt32))

Initialize with a Time and random data

init(time: Time = Clock.realtime.now())
init<T: RandomNumberGenerator>(time: Time = Clock.realtime.now(), generator: inout T)

Get time and random data from a ULID

ulid.time: Time
ulid.rawTime: (high: UInt32, low: UInt16)
ulid.random: (UInt16, UInt32, UInt32)

GitHub

link
Stars: 1
Last commit: 4 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

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