Swift · Installation

Installation

6.0.0-rc.1 · 91a27bdd

Add StringZilla as a Swift Package Manager dependency in your Package.swift.

let package = Package(
    name: "MyApp",
    dependencies: [
        .package(url: "https://github.com/ashvardanian/StringZilla.git", from: "6.0.0")
    ],
    targets: [
        .target(
            name: "MyApp",
            dependencies: [
                .product(name: "StringZilla", package: "StringZilla")
            ]
        )
    ]
)

SwiftPM downloads the C kernels prebuilt, as the release’s StringZillaC XCFramework on Apple platforms and as its artifact bundle on Linux, Android, Windows and WebAssembly, so no C toolchain is needed. A checkout builds its own with CMake and points STRINGZILLA_SWIFT_ARTIFACT at it, relative to the package root:

cmake --preset swift
cmake --build --preset swift
STRINGZILLA_SWIFT_ARTIFACT=build_swift/StringZillaC.xcframework swift test # StringZillaC.artifactbundle off Apple platforms

Then import the module where you need it.

import StringZilla

The product name is StringZilla; importing it pulls in both the Swift extension and the underlying C kernels.