Case Study · 2026
Bank Balance Widget
A native iOS home-screen widget that shows your true spendable balance — your selected account balances minus this month's unbilled card spend, at a glance. Built with SwiftUI and WidgetKit, with an App-Group cache so the widget renders offline and your bank token never leaves the app.
Background
Your current account can look healthy while a chunk of unbilled credit-card spend is quietly invisible — money that is already gone, just not yet billed. This widget surfaces the number that actually matters: what is safe to spend once the card bill lands. It nets your selected Starling account balances against this month’s card spend and puts a single, honest figure on your home screen, in Small, Medium and Large sizes.
The app computes, the widget only renders
The architecture follows the correct WidgetKit pattern: the widget never touches the network. The app holds your Starling personal access token in the Keychain, fetches your balances, adds your current-month card spend, computes the snapshot, and writes it to a shared App-Group container — then asks WidgetKit to reload. The widget’s timeline provider reads only that cached snapshot, so it renders instantly and offline, costs no battery, and the token never leaves the app. Clean separation: the app owns the network and the secrets, the widget owns the pixels.
Pick what counts
Not every account should count toward “spendable”. The app fetches all your accounts and lets you toggle which ones feed the total; flipping a toggle — or editing the card-spend figure — recomputes the snapshot instantly from cached data, with no round-trip to the bank. The selection and the netting math live in a pure, dependency-free Swift core — a spendable-balance calculator and a transactions-to-this-month calculator — that is unit-tested in isolation, so the number is provably correct before any UI is involved.
Automating card spend with Open Banking
Entering card spend by hand works, but the goal was to make it automatic. Using GoCardless Bank Account Data, on the free AIS tier, the app can connect to your card issuer, complete the bank-auth flow, and pull this month’s transactions to compute the spend for you — with manual entry kept as the fallback where issuer coverage is patchy. The connection coordinator and the transactions-to-spend calculator are implemented and unit-tested behind a swappable card source, so “Manual” and “Automatic (Open Banking)” are the same computation fed from two inputs.
Security judgement
Secrets are treated as secrets: the Starling token and any Open-Banking credentials are stored in the Keychain, never in the widget, and never on the network path the widget can see. Just as important is knowing where this personal build stops short of a shipping product — in a real app the GoCardless keys belong on a backend that proxies the calls, never baked into the app binary, which is exactly why the repo carries a proxy-backend scaffold rather than pretending the client-side approach is production-ready.