Swiftpack.co - scru128/swift-scru128 as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by scru128.
scru128/swift-scru128 0.2.1
SCRU128: Sortable, Clock and Random number-based Unique identifier
⭐️ 0
🕓 2 days ago
.package(url: "https://github.com/scru128/swift-scru128.git", from: "0.2.1")

SCRU128: Sortable, Clock and Random number-based Unique identifier

SCRU128 ID is yet another attempt to supersede UUID in the use cases that need decentralized, globally unique time-ordered identifiers. SCRU128 is inspired by ULID and KSUID and has the following features:

  • 128-bit unsigned integer type
  • Sortable by generation time (as integer and as text)
  • 26-digit case-insensitive portable textual representation
  • 44-bit biased millisecond timestamp that ensures remaining life of 550 years
  • Up to 268 million time-ordered but unpredictable unique IDs per millisecond
  • 84-bit layered randomness for collision resistance
import Scru128

print(scru128()) // e.g. "00RNOS8DGRPBRNGKN57QHSVFDC"
print(scru128()) // e.g. "00RNOS8DGRPBRNIKN57RO9NCBG"

See SCRU128 Specification for details.

Add swift-scru128 as a package dependency

To add this library to your Xcode project as a dependency, select File > Add Packages and enter the package URL: https://github.com/scru128/swift-scru128

To use this library in a SwiftPM project, add the following line to the dependencies in your Package.swift file:

.package(url: "https://github.com/scru128/swift-scru128", from: "0.2.1"),

And, include Scru128 as a dependency for your target:

  name: "<target>",
  dependencies: [.product(name: "Scru128", package: "swift-scru128")]


Copyright 2021 LiosK

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at


Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


Stars: 0
Last commit: 2 days ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

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