UUIDKit 🌍
UUIDKit is a modern Swift library designed for generating and manipulating Universally Unique Identifiers (UUIDs) in adherence to RFC 4122 standards.
🔒 Secure by Default: UUIDKit has transitioned to using Apple's built-in CryptoKit
for cryptographic operations, ensuring robust security without relying on external open-source solutions.
Features
- RFC 4122 Compliance: Create and manage UUIDs conforming to the RFC 4122 standard.
- Native Cryptography: Harness the power and security of Apple's
CryptoKit
.
Usage
For detailed instructions and examples on how to use UUIDKit
, please refer to the original project's README at the baarde/uuid-kit GitHub repository.
However, here's a basic example to get you started:
import UUIDKit
let uuidv3 = UUID.v3(name: "thats.an.example", namespace: .dns)
let uuidv5 = UUID.v5(name: "http://example.com/index.html", namespace: .url)
For more intricate uses, like manipulating specific parts of a UUID or performing specific cryptographic operations with CryptoKit
, please consult the aforementioned repository.
Installation Instructions
Using Swift Package Manager with Xcode:
-
Open your Xcode project: Launch Xcode and open your target project or create a new one.
-
Navigate to File > Swift Packages > Add Package Dependency: This will open a new window where you can search or enter the URL of a Swift package.
-
Enter the Repository URL: In the search bar, paste the following URL:
https://github.com/haifengkao/uuid-kit
Then, click the "Next" button.
-
Choose the Version or Branch: Select the version or branch you want to use. For the latest stable version, it's usually recommended to select the default version provided. Click "Next".
-
Select the Target: Decide which target in your Xcode project you want to add the library to. After selecting, click "Finish".
-
Import and Use: Now, in any Swift file within that target, you can simply use:
import UUIDKit
to access the library's functionality.
Using Swift Package Manager from the Command Line:
If you prefer working from the terminal and have a Swift package, you can add UUIDKit
as a dependency by adding the following to the dependencies
value of your Package.swift
:
dependencies: [
.package(url: "https://github.com/haifengkao/uuid-kit", from: "0.2.0")
]