Skip to content

gossamr/swift-uuid-base64url

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UUIDB64URL

Swift Platform License

UUIDB64URL is a simple Swift Package that extends the UUID class to add support for decoding UUIDs from and encoding UUIDs to base64url (RFC 4648) strings.

Installation

Swift Package Manager

To integrate UUIDB64URL into your Xcode project using Swift Package Manager, follow these steps:

  1. Open your target in Xcode.
  2. Go to "File" -> "Add Package Dependencies...".
  3. In the search bar, enter https://github.com/gossamr/swift-uuid-base64url.git and click "Add Package".

Usage

Import the UUIDB64URL package in your Swift files:

import UUIDB64URL

Encoding UUID to Base64url

To encode a UUID instance to a base64url string, use the following accessor:

let uuid = UUID()
let base64urlString = uuid.base64url
print("UUID encoded as Base64url String: \(base64urlString)")

Decoding Base64url to UUID

To decode a base64url string back to a UUID instance, use the following initializer:

let recovered = UUID(base64url: base64urlString) // returns UUID?, as decoding can fail

License

UUIDB64URL is released under the MIT license. See LICENSE for more information.

Contributing

Contributions are welcome! Please open an issue or submit a pull request to improve this package.

About

A simple Swift Package that extends the UUID class for encoding/decoding UUIDs as base64url Strings

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages