8000 GitHub - project-minigraf/minigraf-swift at v2.x · GitHub
[go: up one dir, main page]

Skip to content

About

Swift/iOS binding for Minigraf — bi-temporal graph database

Resources

Stars

1 star

Watchers

0 watching

Forks

 
 

Repository files navigation

minigraf-swift

Use Minigraf from Swift. Store data in an embedded, single-file graph database and query it with bi-temporal Datalog.

Installation

Swift Package Manager

In Xcode: File → Add Package Dependencies → enter this repo URL.

Or add to Package.swift:

dependencies: [
    .package(url: "https://github.com/project-minigraf/minigraf-swift", from: "2.0.12")
]

Each semver tag v<version> points to a commit on the swift-releases branch. That commit holds the Package.swift with the release's xcframework URL and checksum, plus the generated Swift sources. After the branch move, source-v<version> marks the matching commit on main for 3.x or v2.x for 2.x. Releases up to v2.0.0 were tagged differently; see Older releases below. The v2.0.1 tag was moved to its swift-releases commit after the fact, so it resolves normally but has no source-v2.0.1 tag.

Older releases

Before the tagging fix, the release workflow put the semver tag on the source commit, whose Package.swift has a placeholder checksum and no generated sources. The tags v2.0.0 and earlier do not resolve. For those versions, the working manifest is on the swift-v<version> tag, which SPM cannot resolve by version. Pin that tag's commit instead, for example:

// swift-v2.0.0
.package(url: "https://github.com/project-minigraf/minigraf-swift", revision: "1307a095c1725d2813abbbdcf17557311d517d24")

Use git ls-remote --tags https://github.com/project-minigraf/minigraf-swift 'swift-v*' to find the commit for another version.

No release up to and including v2.0.8 compiles: its xcframework names the C module map minigraf_ffiFFI.modulemap instead of module.modulemap, so the generated Swift cannot import the FFI module ("cannot find type 'RustBuffer' in scope"). Use v2.0.9 or later.

Requires iOS 16+.

Quick start

import MinigrafKit

let db = try MiniGrafDb.openInMemory()
let result = try db.execute(datalog: #"(transact [[:alice :name "Alice"]])"#)
print(result)  // {"transacted":1}

Building from source

Requires Rust stable toolchain with iOS targets and Xcode.

rustup target add aarch64-apple-ios aarch64-apple-ios-sim
cargo build --target aarch64-apple-ios --release
cargo build --target aarch64-apple-ios-sim --release
cargo run --bin uniffi-bindgen -- generate \
  --library target/aarch64-apple-ios/release/libminigraf_ffi.a \
  --language swift \
  --out-dir Sources/MinigrafKit/

Cascade release

When core publishes a 2.x release, its cascade sends the full tag to this repository in a core-release event. The default workflow on main uses v2.x as the source for that tag and builds with the exact core crate version. It builds and zips the iOS device and simulator xcframework, updates Package.swift on swift-releases, and tags the package commit for SwiftPM. The GitHub Release carries the zip. See the release guide on main for rehearsal and recovery details.

License

MIT OR Apache-2.0

About

Swift/iOS binding for Minigraf — bi-temporal graph database

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0