Swiftpack.co -  marcelvoss/Base62 as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
marcelvoss/Base62
A tiny package for Base62 encoding/decoding values.
.package(url: "https://github.com/marcelvoss/Base62.git", from: "0.1.0")

Base62

CI

Base62 is a tiny package for Base62 encoding/decoding values. It is tested, documented, easy-to-use and supports Apple Platforms, as well as Linux.

I use this as encoding mechanism for my own URL shortener but this is a general purpose implementation that should suffice all use cases that require Base62 encoding/decoding.

Installation

Base62 is distributed using the Swift Package Manager. To install it into a project, add it as a dependency within your Package.swift manifest:

let package = Package(
    ...
    dependencies: [
        .package(url: "https://github.com/marcelvoss/Base62.git", from: "0.1.0")
    ],
    ...
)

Then import Base62 wherever you’d like to use it:

import Base62

Usage

Using Base62 is incredibly easy, as it focusses on a single responsibility and does that nicely.

Base62 ships with a single object that provides encoding and decoding functionality.

let base62Encoded = Base62.encode(2021)
// 2021 == "wz"

let base62Decoded = try Base62.decode("GitHub")
// "GitHub" == 38750631667

There are also extensions for String and Int available, if you prefer to use them rather than the Base62 object directly.

GitHub

link
Stars: 1
Last commit: 3 days ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Release Notes

v0.1.0
3 days ago

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