Apple apps guide
How to build, run and ship the native Cardsite apps (iPhone, iPad, Mac, Vision Pro and Watch, with the widgets and the share extension) from this monorepo. The code and its rules are in apps/apple/README.md. Status and the launch checklist are in apps/apple/docs/launch/native-apple.md.
Requirements
- A Mac with Apple silicon, Xcode 26 or later (27 is current), and XcodeGen 2.42 or later (
brew install xcodegen). - The whole monorepo. The app links StudioKit 2.2 at
design/studio/packages/swiftby relative path, and its navigation registry is generated fromapps/web/src/lib/navigation.tsandpackages/link-model(apps/apple/docs/ARCHITECTURE.md). - Linux has no Swift toolchain. There you can run the static gate (
make -C apps/apple check) and the contract harness. The gate parses every Swift file, cross-checks every StudioKit 2.2 call and the app's own initialiser labels, runs the design lint and the config check, and checks the generated files and fixtures. It does not compile.
Setup
(cd design/studio && npm ci) # once: tree-sitter for the syntax gate
make -C apps/apple check # static gate, any OS
cd apps/apple
./scripts/doctor.sh # paths, toolchain, build configs
cp Config/Signing.example.xcconfig Config/Signing.xcconfig # set DEVELOPMENT_TEAM
make build # xcodegen, then xcodebuild for iOS Simulator, macOS, visionOS Simulator
make build XCODE=/Applications/Xcode-beta.app # with Xcode-beta
open Cardsite.xcodeproj
make build compiles with signing off and writes its logs to apps/apple/.build/. make test runs CardsiteKit's and StudioKit's swift test, then the app's tests on an iPhone Simulator (SIMULATOR="iPhone 17 Pro" by default).
When the web's navigation changes (apps/web/src/lib/navigation.ts, packages/link-model), run node scripts/gen-apple-navigation.mjs and commit apps/apple/Cardsite/Generated/Navigation.swift; make check fails until you do. A web destination with no Apple decision fails the Swift compile at the exhaustive switch in Cardsite/App/Destinations.swift (NavDestinationID.inApp).
Environments
Each configuration sets CARDSITE_API_BASE_URL (and CARDSITE_WEB_URL) in its xcconfig, and Info.plist reads it as CSAPIBaseURL.
| Config | Scheme | API | Set in |
|---|---|---|---|
| Debug | Cardsite, Cardsite Demo (fixtures, no server) | http://localhost:8080 | Config/Debug.xcconfig; per-machine override in Config/Local.xcconfig (git-ignored) |
| Staging | Cardsite Staging | the GCP staging origin; the committed value is the placeholder https://staging.cardsite.io | Config/Staging.xcconfig; CI writes Config/Staging.ci.xcconfig from vars.CARDSITE_STAGING_API_URL |
| Release | Cardsite (archive) | https://cardsite.com (owner decision N2) | Config/Release.xcconfig |
Staging is Release-optimised. It has no DEBUG flag and no fixture server, and its home-screen name is "Cardsite Staging". It uses the same bundle ID as production, so a staging build goes to internal TestFlight testers only and is never submitted for review.
Plain HTTP works only for local hosts: ATS keeps NSAllowsLocalNetworking and never allows arbitrary loads. That one key is in every configuration, because a single Info.plist serves all three. scripts/check-config.sh fails if Staging, Release or the CI-injected origin is anything but https://.
Running against a stack
The local stack (
make upat the root): the API is on:8080, so Debug works as is on the Simulator and the Mac. For a device, setConfig/Local.xcconfigtohttp:/$()/Your-Mac.local:8080.The staging-parity stack (
scripts/staging/local-native.sh): web on:18080, API on:18081. SetCARDSITE_API_BASE_URL = http:/$()/localhost:18081inConfig/Local.xcconfig.Real staging: run the
Cardsite Stagingscheme, with the Cloud Run origin inConfig/Staging.ci.xcconfig(copyStaging.ci.example.xcconfig).The contract harness runs on Linux too (bash, curl, jq; psql for the parity section). See
apps/apple/ContractTests/README.md.cd apps/apple/ContractTests WRITE_FIXTURES=0 ./native-contract.sh http://localhost:18081 PSQL_URL='postgres://cardsite@127.0.0.1:18432/cardsite_db?sslmode=disable' TWOFA_LOGIN=1 WRITE_FIXTURES=0 ./native-contract.sh http://localhost:18081Leave out
WRITE_FIXTURES=0only when you mean to re-capture. Then runscripts/sync-fixtures.sh.
CI
.github/workflows/apple.yml runs on changes to apps/apple/**, design/studio/packages/swift/**, the navigation generator and its inputs, or the workflow. The jobs and what a green run proves are in the workflow header.
- Linux:
fixtures, andlint(make check, the static gate). - macOS 26:
kit,app(four destinations plus one Staging build),screensandscreens-publish.screens-publishwrites to the orphanscreensbranch.
TestFlight
.github/workflows/apple-testflight.yml is the TestFlight lane. It runs on a tag apple-v<version>, which also sets MARKETING_VERSION, or by hand, where you choose the configuration (Staging or Release) and the platforms (ios, macos or both). The build number is the run number.
The lane archives with -allowProvisioningUpdates and the API key, exports with method app-store-connect, then runs xcrun altool --validate-app and --upload-app. If anything below is missing, it stops with a notice.
| Name | Kind | Value |
|---|---|---|
ASC_KEY_ID, ASC_ISSUER_ID, ASC_KEY_P8 | secrets | App Store Connect API key (App Manager or Admin; Admin if Xcode must create the certificates) |
APPLE_TEAM_ID | variable | team ID |
CARDSITE_STAGING_API_URL | variable | https:// Cloud Run URL (or custom domain) of the staging API; Staging runs only |
CARDSITE_STAGING_WEB_URL | variable | staging web origin; defaults to the API origin |
CARDSITE_BUNDLE_ID | variable, optional | overrides com.cardsite.app |
APPLE_DIST_CERT_P12, APPLE_DIST_CERT_PASSWORD | secrets, optional | an Apple Distribution certificate; without one, Xcode cloud signing is used |
Before the first run:
- The App Store Connect record exists.
- The four App IDs, the App Group and the keychain group are registered (
native-apple.mdA25).
Device checklist
Before any external release, walk the device checklist on a Simulator against the local stack, then on devices with the TestFlight Staging build.
Source: docs/guides/apple.md