Back to Baml

baml-swift

baml_language/sdks/swift/mirror/README.md

0.226.11.7 KB
Original Source

baml-swift

SwiftPM distribution of the BAML Swift bridge: the BamlBridge runtime package plus the BamlBridgeFFI native XCFramework (macOS arm64/x86_64, iOS device, iOS simulator).

This repo is a passive mirror. Nothing here is edited by hand. The monorepo's release pipeline builds the XCFramework, attaches it to the baml-language-<version> release on BoundaryML/baml, and mirrors this tree (sources + a Package.swift pinned at that release asset) here on every release. Source of truth: BoundaryML/bamlbaml_language/sdks/swift. iOS slices compile and pass simulator tests but are not yet device-certified.

Consuming

swift
// Package.swift
.package(url: "https://github.com/BoundaryML/baml-swift", from: "0.15.0")

In Xcode: File → Add Package Dependencies → paste the URL → pin a version → add the BamlBridge product to your app target.

Each release is an immutable v<version> tag; Package.swift's binary target points at the matching XCFramework asset on the monorepo release, verified by checksum. Your app links only its own architecture (~26 MB).

Generating your typed SDK

The package is the runtime; your typed Baml.* API is generated by the baml CLI from your .baml project (nothing generated ships here):

sh
baml toolchain use nightly      # or a release matching this package's version
baml generate --from /path/to/your-baml-project

The generated SDK and this package must share a canonical version (the register_bridge handshake). The exact source commit each release was built from is recorded in SOURCE_SHA.

Minimums: iOS 16 / macOS 13.