Development guide
How to build, test and run SPB Git for iOS and iPadOS, and the conventions the code follows.
Architecture and "how to add a feature" are in IOS_ARCHITECTURE.md.
Requirements
- Xcode 27.2 (iOS SDK 27.2), a simulator runtime iOS 26.5 or later,
xcodegen(brew install xcodegen). - No package, no pod, no third-party dependency: nothing to resolve.
- Deployment target iOS and iPadOS 26.0. Swift 6 language mode, strict concurrency
complete.
Project
The Xcode project is generated from project.yml:
xcodegen generateBoth project.yml and the generated SPBGit.xcodeproj are committed. Sources are picked up by folder: adding
a Swift file under SPBGit/, SPBGitTests/ or SPBGitUITests/ needs no project edit, only a regeneration
(scripts/build.sh does it every time). Files named *.md and .gitkeep under SPBGit/ are not bundled.
| Target | Kind | Bundle identifier |
|---|---|---|
SPBGit |
application, iPhone and iPad | ai.spboucher.git |
SPBGitWidgets |
WidgetKit extension embedded in the app | ai.spboucher.git.widgets |
SPBGitTests |
unit tests hosted by the app (Swift Testing) | ai.spboucher.git.tests |
SPBGitUITests |
UI tests (XCTest) | ai.spboucher.git.uitests |
Version 1.0.0, build 1 (MARKETING_VERSION, CURRENT_PROJECT_VERSION in project.yml). Team 3YM54G49SN.
Build and test
This machine once froze under parallel Xcode builds. Run one xcodebuild at a time. scripts/build.sh
enforces it: it waits while any other xcodebuild process is running, writes the full output to
build/logs/ and prints only errors and test totals.
scripts/build.sh build # app + test bundles, simulator
scripts/build.sh test # unit tests (SPBGitTests)
scripts/build.sh test SPBGitTests/DeepLinkTests # one suite (any -only-testing identifier)
scripts/build.sh uitest # UI test: launches the real app, checks the five tabs
scripts/build.sh test SPBGitUITests/InsightsUITests # UI tests against the live forge: search typing, insights, explorer
scripts/build.sh live # live visitor-pass round trip against production (see below)
scripts/build.sh test SPBGitUITests/PlatformUITests # live: spbgit:// links, an offline download read without network, keyboard shortcuts
scripts/build.sh test SPBGitUITests/ReadPathUITests # live: Home → repository → file → history → commit → diff, and back to Home
scripts/build.sh test SPBGitUITests/AccessibilityAuditUITests # live: performAccessibilityAudit on 18 screens, light and dark (about 15 min)
python3 scripts/l10n-audit.py # after a build: every string of the app and the widgets is in the catalog, in English and French;
# every App Shortcut phrase has its French form (AppShortcuts.xcstrings)
sp-header check . # source headersDerived data goes to build/dd (ignored by git). The destination is the simulator named SPBGit iPhone;
set SPBGIT_SIMULATOR="SPBGit iPad" to use the iPad.
Simulators
Two dedicated devices, so that work on this app never disturbs another project's simulator:
xcrun simctl create "SPBGit iPhone" com.apple.CoreSimulator.SimDeviceType.iPhone-17-Pro com.apple.CoreSimulator.SimRuntime.iOS-26-5
xcrun simctl create "SPBGit iPad" com.apple.CoreSimulator.SimDeviceType.iPad-Pro-13-inch-M5-12GB com.apple.CoreSimulator.SimRuntime.iOS-26-5Boot only the one you need and shut it down afterwards (xcrun simctl shutdown "SPBGit iPhone").
Running the app from the command line
APP=build/dd/Build/Products/Debug-iphonesimulator/SPBGit.app
xcrun simctl boot "SPBGit iPhone"
xcrun simctl install "SPBGit iPhone" "$APP"
xcrun simctl launch "SPBGit iPhone" ai.spboucher.git -SPBScreen repositories -SPBAppearance dark -SPBLocale fr
xcrun simctl io "SPBGit iPhone" screenshot build/screenshots/dev/repositories-dark-fr.pngscripts/screenshots.sh does this for the standard set (Home, Repositories, one repository; light and dark;
English and French) into build/screenshots/dev/, which git ignores: development captures are not committed. The
curated set shown by the README is docs/screenshots/ (16 images at most); the store set is
docs/appstore/screenshots/, produced by scripts/appstore-screenshots.sh (see below).
Store screenshots
scripts/build.sh build
scripts/appstore-screenshots.sh # or: iphone | ipadCreates the simulators SPBGit store iPhone (iPhone 17 Pro Max, 1320 x 2868) and SPBGit store iPad (iPad Pro
13-inch, 2064 x 2752) when they do not exist, overrides the status bar (9:41, full battery, full signal), opens
eight screens by launch arguments in English and French, checks the pixel size of every file with sips, and
writes docs/appstore/screenshots/{iphone-6.9,ipad-13}/{en,fr}/NN-name.png. Code and diff are dark, the rest
light. The pictures are the real application on the data of the forge at that moment: run it once, look at
every file, run it again if a load was slow (the delay of each screen is in the table at the top of the script).
Launch arguments (Debug builds only)
Parsed by LaunchOptions (SPBGit/App/LaunchOptions.swift) inside #if DEBUG: they do not exist in a
Release binary.
| Argument | Values | Effect |
|---|---|---|
-SPBScreen |
home, repositories, repository:<name>, activity, insights, profile, search |
opens on that tab, or on a repository inside the Repositories tab |
-SPBScreen |
tree:<repository>:<ref>:<path> (empty ref: default branch; empty path: root) |
opens a directory in the file explorer |
-SPBScreen |
blob:<repository>:<ref>:<path> with an optional #L<line> suffix |
opens a file in its viewer, at that line for code |
-SPBScreen (history) |
commits:<repo>[:<ref>], history:<repo>:<path>, commit:<repo>:<sha>, diff:<repo>:<sha>[:<path>], graph:<repo>, branches:<repo>, tags:<repo>, releases:<repo>, compare:<repo>:<base>:<head> |
opens that history screen under its repository (LaunchOptions+History.swift) |
-SPBActivity |
following, today, week, month, or an event type (tag_created…) |
filter the Activity tab starts with |
-diff.sideBySide, -diff.wrap |
YES, NO |
diff viewer preferences for this launch (argument domain of UserDefaults) |
-SPBAppearance |
light, dark |
forces the appearance |
-SPBLocale |
en, fr |
forces the language (and the en_CA / fr_CA region) for this launch |
-SPBVisitorPass |
off |
does not request a visitor pass at launch (UI tests, repeated launches) |
-SPBScrollTo |
readme |
a repository opens scrolled to its README (store screenshots) |
-SPBScreen (features) |
insights:<activity|code|repositories|research|apple|compare>, metric:<chart id or figure.<id>>, collection:<id>, repository-insights:<name>, search:<text>, compare:<a,b,…> |
opens a group of Insights, a metric detail (MetricChart / MetricFigure raw values), a collection, the insights of a repository, a search that runs at once, a comparison |
-SPBSearch |
scope=<all|repos|files|code|readmes|commits|branches|tags>,repository=<name>,language=<name>,regex=1,word=1,case=1,exact=1 |
scope and filters of -SPBScreen search:<text> |
-SPBRepositories |
layout=<list|grid>,language=<name>,topic=<name>,collection=<id>,sort=<activity|name|created|size|commits>,favourites=1,text=<words> |
initial state of the explorer |
-SPBHome |
range=<month|quarter|year|all>,year=<yyyy> |
period of the activity chart and year of the contribution calendar on Home |
-SPBScreen (owner) |
settings, administration, admin-overview, audit[:<repo>], tokens, new-repository, edit-repository:<repo>, changes:<repo>:<branch>, edit:<repo>:<branch>:<path> |
opens that owner screen (LaunchOptions+Owner.swift) |
-SPBServer |
http://127.0.0.1:7431 |
targets a local development server (loopback addresses only), with its own cache directory, Keychain service and drafts folder |
-SPBOwnerToken |
a token of the local server | signs in at launch (verified with whoami); accepted only together with -SPBServer |
-SPBBiometry |
allow, deny |
replaces Face ID by a stub that accepts or refuses (the simulator has no enrolled biometry) |
-SPBOwnerReset |
removes the stored development token before starting |
| -SPBOffline | (flag) | no network for this launch: the client answers offline to everything it cannot serve from an offline copy or the cache, Reachability says offline |
| -SPBScreen (platform) | offline, notifications, widgets[:<1-4>], offline-download:<repo> | the Offline screen, the notification settings, the widget gallery (one page of it), a repository whose offline download starts at once |
| -SPBBackgroundCheck | run, rewind | runs the handler of the background refresh once at launch (rewind: as if the last check were a day old) |
| -SPBFollow, -SPBNotifications | <repo>, provisional | follows a repository; turns notifications on with a provisional authorisation (no prompt) |
A launch with -SPBScreen does not restore the navigation a previous launch left (SceneStorage).
When the process hosts the unit tests (XCTestConfigurationFilePath in the environment) the app builds no
interface and makes no request.
Tests
Unit tests use Swift Testing (import Testing, @Suite, @Test, #expect). They never touch the network:
SPBGitTests/TestSupport/StubServer.swift: an in-process forge. EachStubServerowns aURLSessionrouted byStubURLProtocol(one private host per instance, so suites run in parallel) and records the requests it received.server.makeClient()returns anAPIClientwired to it with a private disk cache.SPBGitTests/Fixtures/*.json: payloads.- Files without prefix are real production answers (server 3.2.0), fetched with
curland trimmed:repos,repo,languages,commits,tree,releases,search,stats,healthz,error_not_found,pass_challenge. - Files prefixed
v33_are written fromdocs/API_CONTRACT.mdsection 2 (server 3.3.0, not deployed when they were written). When 3.3.0 ships, replace them with real answers and fix what differs. metrics,repo_metrics,metrics_compare,collections,search_code_shield,search_all_shield,search_tags,suggestionsare real 3.3.0 answers (2026-12-02), trimmed; the metric, chart-preparation and search tests use them.
- Files without prefix are real production answers (server 3.2.0), fetched with
- To refresh a real fixture:
curl -s -A "SPBGit-iOS/1.0.0 (1; iOS 26.5)" https://git.spboucher.ai/api/v1/stats, trim, save. Do not loop over costly routes (tree,commits,search,raw): the shield budget is tiny.
Live visitor-pass test
VisitorPassLiveTests talks to https://git.spboucher.ai for real: challenge, proof of work, redeem, then a
tree and a commits request with the pass. It is skipped unless the test process has SPBGIT_LIVE=1:
scripts/build.sh live # sets TEST_RUNNER_SPBGIT_LIVE=1, prints the lines starting with "LIVE:"The server issues six passes per hour and per address while in attack mode: run it once, not in a loop.
Owner mode: the local development server
Authenticated and write development never touches https://git.spboucher.ai. It runs against a throw-away
spbgit 3.3.0 on 127.0.0.1:7431, started from a checkout of the server (SPBGIT_SERVER_DIR, by default
../../_spbgit-server-work, only read) with its data under build/devserver/ (ignored by git):
scripts/devserver.sh seed # bare clones of two small public repositories + one empty repository
scripts/devserver.sh start # stop | status | reset
scripts/devserver.sh token "my iPhone" repo:write,tokens 30 # label, scopes (none: every scope), days
scripts/devserver.sh expired-token
scripts/devserver.sh push <repo> <branch> <path> <text> # a push from the shell, to provoke head_moved
xcrun simctl launch "SPBGit iPhone" ai.spboucher.git -SPBServer http://127.0.0.1:7431 \
-SPBOwnerToken "$TOKEN" -SPBBiometry allow -SPBScreen administration
scripts/owner-integration.sh # SPBGitTests/OwnerIntegrationTests: every write and every refusal
scripts/owner-integration.sh ui # SPBGitUITests/OwnerUITests: the owner flows in the real appBoth suites are skipped without the environment the script sets, and refuse any host that is not a loopback
address. A Debug build reads its Info.plist from Resources/Info-Debug.plist, which is Info.plist plus
NSAllowsLocalNetworking (plain HTTP to the local server); OwnerPlistTests checks that this is the only
difference and that the Release plist has no App Transport Security key. Keep the two files in step.
Localization
- Development language English, plus French (Québec). One String Catalog:
SPBGit/Resources/Localizable.xcstrings. Keys are the English strings. - In views,
Text("…"),Label("…", systemImage:),Button("…")with a literal are localized. AStringvariable is not: for a conditional title writelet title: LocalizedStringKey = flag ? "A" : "B". - Outside views use
String(localized: "…"); for values passed around useLocalizedStringResource. - Text that is data (repository names, hashes, paths) uses
Text(verbatim:). - Counts use plural variations in the catalog (
%lld commits). python3 scripts/l10n-audit.py(after a build) fails when a string used by the code is missing from the catalog or has no French translation.- Two counts in one sentence are two strings, each with its plural forms, joined in code
(
SPBFormat.lineChanges): "1 addition, 2 deletions", never "1 additions".
Glossary (French)
One term per notion, in every feature. Checked on the whole catalog on 2026-12-03.
| English | French | Notes |
|---|---|---|
| repository | dépôt | |
| branch | branche | |
| tag | étiquette | |
| release | version (publiée) | "Versions" as a title; "fichier de version" for a release file |
| commit, to commit | commit, commiter | "commité" for the past participle |
| push (noun), pushed | poussée, poussé | "notifications push" is Apple's own term and stays |
| hash | empreinte | |
| ref | référence | |
| favourite | favori | |
| pinned | épinglé | |
| followed | suivi | "ne plus suivre" for unfollow |
| offline | hors ligne | |
| topic | sujet | |
| collection | collection | |
| insights | analyses | tab and section title |
| changes (diff) | modifications | "Voir les modifications" |
| staged | en attente | "mettre en attente" |
| draft | brouillon | |
| access token, scope | jeton d'accès, portée | |
| shield | bouclier (anti-moissonnage) | |
| owner mode | mode propriétaire | |
| permalink | lien permanent | |
| clone | cloner, commande de clonage | |
| download | télécharger, téléchargement | |
| settings | réglages | as in iOS |
Conventions
- Files: one type or one cohesive group per file, at most about 300 lines including the header.
- Source header: every Swift file starts with the official SP Boucher header. A hook adds it on write;
sp-header fix .adds missing ones,sp-header check .validates. Do not write it by hand. Comments must not contain phrases that mark a file as produced by a tool (the engine then skips the file). - Design system only: colours from
SPBColor, fonts fromSPBTypography, spacing fromSPBSpacing, animations throughspbAnimation/SPBMotion.animation(_:reduceMotion:). No literal colour, no fixed font size in a feature. - Loading: a screen exposes
LoadState<Value>and renders it withLoadableView. - Navigation:
NavigationLink(value: Route.…)orrouter.open(_:); never a destination closure. - Networking: features talk to services (
RepositoryService…), never toAPIClientorURLSession. Load from.task(cancelled when the view disappears); never one request per row. - Previews: every design-system component has a
#Preview. Samples live inSPBGit/PreviewSupport/PreviewData.swift, compiled in Debug only; production code has no sample data. - Colours: edit the table in
scripts/generate-colors.py, run it, commit the colour sets. - Commits: Conventional Commits in English, one coherent step each,
sp-git commit -m "…" <files>thensp-git push. - Never: a secret in the repository, an ATS exception, a third-party SDK, a WebView.
Offline, widgets and platform tests
SPBGitTests/TestSupport/OfflineForge.swiftserves a small repository through aStubServer, with real git object ids;offline_blob_gitignore,offline_tree_root,offline_tree_scriptsandplatform_branchesare real 3.3.0 answers.- Widgets cannot be added to the simulator home screen by a script. Their views are in
Shared/and the Debug gallery (-SPBScreen widgets, pageswidgets:1towidgets:4) draws every widget in every family with the figures the forge gives at that moment, plus the placeholder, unconfigured and unavailable states. xcrun simctl openurlwith aspbgit://link shows the system confirmation alert, which a script cannot accept:PlatformUITestsusesXCUIApplication.open(_:)instead.- The keyboard shortcut UI test is opt-in (
TEST_RUNNER_SPBGIT_KEYBOARD=1, iPad simulator): synthesized ⌘ keys reach the app in some runs and not in others with the same build.RouterPlatformTestscovers the logic. - Universal Links, Handoff, APNs and the real background refresh need a signed build on a device.