GitHub
The iOS app

The iOS app

apple/ios/ is a SwiftUI shell around the same SPA the desktop app embeds (plan 42). The Rust core (crates/ledgeline-ffi, mobile feature) runs in-process, linked as a static library. The app’s web view loads ledgeline://localhost/, and a URL scheme handler passes every request to the core’s router. There’s no socket and no port. The contract between Swift and Rust is in crates/ledgeline-ffi/README.md, and the bridge between the page and Swift is in plan 42.

The Swift is split so the invoicer’s app (plan 51) can share it:

Each app lists a sample on its first launch and rewrites it on every open, so it is always fresh and dated to this month. Both write the same sample books (write_sample_books(), ledgeline_core::sample_books), each into its own Documents/Sample folder: Ledgeline’s sample journal plus a small side business, with a company note, four customers (one with a purchase order, one on the Modern template), a catalog, a payment snippet, eight invoices (paid, part paid against a deposit, voided and reissued, overdue with deferred revenue, not yet due, a draft), unbilled time and a contractor’s bill. The files are checked in under crates/ledgeline-core/src/sample_books/, generated by the invoicer’s own code (just sample-books, ledgeline_invoicer::sample); Rust moves every date by whole months into the device’s current month. The apps don’t share one folder (each sample is in its app’s own container), so Ledgeline’s Invoices page still offers no Open Ledgeline Invoicer on its sample.

Both apps are in the App Group group.com.zmre.ledgeline (Ledgeline/Ledgeline.entitlements). The saved list is stored in the group’s defaults and the config folder (ui-prefs.toml) in the group container, so both apps share them. Bookmarks are per app, so an entry this app has no grant for shows “Allow access”. On its first launch after the update, Ledgeline copies its old list and config folder into the group once and leaves the old copies in place. Without the group (a build signed without it), the app falls back to its own list and folder, and the log says so.

You need macOS with Xcode 26, the Nix dev shell (it includes the iOS Rust targets), and bun.

Commands

CommandWhat it does
just ios-buildBuilds the SPA, the release staticlibs, the Swift bindings, the xcframework and the simulator app.
just ios-runDoes the same, then boots the “iPhone 17” simulator, installs the app and launches it.
just ios-testRuns the Swift unit tests on the simulator.
just ios-deviceBuilds a signed Release app for a device.
just ios-installInstalls the last device build on $LEDGELINE_IOS_DEVICE and launches it.

Each recipe calls apple/ios/build.sh [--app ledgeline|invoicer] <mode>, and the modes are rust, build, run, device, install and test. --app defaults to ledgeline; --app invoicer builds the invoicer’s app (invoicer-ffi, apple/ios/Generated/Invoicer/). The script’s header lists its environment variables. These are the ones you’ll use most:

How the build fits together

  1. bun run build in web/. crates/ledgeline-server/build.rs mirrors web/build into the crate’s spa/.
  2. scripts/ios-check.sh build cross-compiles ledgeline-ffi for aarch64-apple-ios and aarch64-apple-ios-sim. It always uses the release profile, whatever the Swift configuration, because rust-embed bakes the SPA into release builds only. A debug staticlib would read spa/ from disk at run time, and that path doesn’t exist on a phone. The script’s shims send only the target-side C compiles to Xcode’s SDK.
  3. The crate’s uniffi-bindgen bin (feature bindgen) writes the Swift bindings to apple/ios/Generated/, which is checked in. It replaces files only when they change.
  4. xcodebuild -create-xcframework produces LedgelineFFI.xcframework.
  5. XcodeGen produces Ledgeline.xcodeproj from project.yml. It comes from nix run nixpkgs#xcodegen unless one is on PATH.
  6. xcodebuild runs with the Nix shell scrubbed from its environment (env -i, DEVELOPER_DIR set to Xcode’s).

The project file, the xcframework and target/ios-* are build products and aren’t committed.

Gotchas