GitWorkbench 1.2.0
What's new in 1.2.0
Observe the repository summary. A new public view modifier hands your host a small, stable snapshot of the repository so you can drive your own chrome — a menu-bar item, dock badge, window title, or sidebar badge — without running git again or reaching into the store:
GitWorkbenchView(store: store)
.onRepositorySummaryChange { summary in
// summary.currentBranch, .changedFileCount, .stagedCount, .unstagedCount,
// .hasConflicts, .additions/.deletions, .needsPush/.needsPull, .isClean, .isBusy
}The closure fires once the first load has completed, then once per distinct summary (deduplicated via Hashable) — the pre-load empty placeholder is never delivered, so there's no isEmpty guard to write. Stacking is additive: applying it from two independent feature layers runs both observers.
RepositorySummary is a Sendable, Hashable value whose convenience flags (changedFileCount, needsPush, needsPull, isClean) are computed from its stored primitives, so it can never be internally inconsistent.
Headless store.summary. GitWorkbenchStore is now @Observable and exposes the same snapshot directly:
public private(set) var summary: RepositorySummary? // nil until the first load completesA host that already holds the store can read store.summary in its own SwiftUI body — updated live as the working tree changes — even while no GitWorkbenchView is mounted. Useful for a badge or sidebar branch that's visible when the git UI isn't.
Upgrading from 1.1.0
GitWorkbenchStore moved from ObservableObject to the @Observable macro. If your host stored it with @StateObject / @ObservedObject, switch to @State (for an owned store) or a plain let reference, and use @Bindable where you need a two-way binding. No method or state shapes changed.
Requirements
- macOS 15+
- Swift 6 (language mode v6)
Installation
.package(url: "https://github.com/gpambrozio/GitWorkbench.git", from: "1.2.0"),