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 platformsThen import the module where you need it.
import StringZillaThe product name is StringZilla; importing it pulls in both the Swift extension and the underlying C kernels.