Swiftpack.co - nerdsupremacist/Fuzzi as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Locally searching in Swift made simple (and fuzzily)
.package(url: "https://github.com/nerdsupremacist/Fuzzi.git", from: "1.0.0")


Locally searching in Swift made simple (and fuzzily). Using a SwiftUI like DSL.


Fuzzi allows you to search efficiently through a lot of data. It uses BK-Tree's as well as a weigthed size based score with the Levenshtein distance of strings to find the correct results and sort them accordingly.


Swift Package Manager

You can install Fuzzi via Swift Package Manager by adding the following line to your Package.swift:

import PackageDescription

let package = Package(
    dependencies: [
        .package(url: "https://github.com/nerdsupremacist/Fuzzi.git", from: "1.0.0")


Start by defining what you want to search.

Like for example a GitHub Repo:

struct Repo {
  let name: String
  let description: String
  let link: URL

Then you can extend your struct by implementing Searchable. With Searchable you now tell our library, what to search for. In our current implementation we want to search for the name, description and link.

extension Repo: Searchable {

    var body: some Searchable {
            .weighted(scale: 5)


            .weighted(scale: 2)


As you can see, we can also perform all kinds of optimizations, such as enabling search with prefixes, postfixes or infixes, and make certain strings in our struct weigh more than others. Then whenever you have a collection of these objects simply use .searchTree() to create a Search Tree.

let tree = repos.searchTree()
tree.search(query: "Fzzi") // Should return the "Fuzzi" repo

Computing this tree might take a bit of time, however, after building this tree, searching through your results is a breeze! We tested this with 10K items (single words). Building the tree took a bit longer than 5 seconds and searching took less than 1 second.


PRs are welcome!


Stars: 11
Last commit: 2 weeks 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.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Related Packages

Release Notes

2 weeks ago

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