diff --git a/.gitignore b/.gitignore index e0503a9..0a9e680 100644 --- a/.gitignore +++ b/.gitignore @@ -42,6 +42,7 @@ logo-options/ .zed/keymap.json .zed/tasks.json .zed/sim +.zed/run.sh buildServer.json # Generated by XcodeGen from project.yml diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index 07a9d9f..919be54 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -56,6 +56,8 @@ Find your device UDID with `xcrun devicectl list devices`. ```bash just sim # Build + install + launch on simulator (production API) just sim-local # Build + install + launch on simulator (local/dev API) +just sim-fresh # Same as `just sim`, but uninstalls first (wipes app sandbox) +just sim-local-fresh # Same as `just sim-local`, but uninstalls first just device DEVICE_ID # Build + install to a plugged-in iOS device just test # Run tests (iPhone 17 Pro Max simulator) just generate # Regenerate Xcode project from project.yml @@ -64,4 +66,6 @@ just lint-fix # Fix lint violations just release # Bump build, archive, upload to App Store Connect ``` +The `*-fresh` variants `xcrun simctl uninstall` your app's bundle id before installing, which clears URLCache, UserDefaults, on-disk caches (FeedCache, LabelDefinitionsCache), and Documents/Caches. Pass `SIM_UDID=` to target a specific simulator (otherwise uses the booted one). + > **Note:** The Xcode project is generated from `project.yml` — run `just generate` after adding or removing Swift files, or after pulling changes that touch `project.yml`. diff --git a/docs/development.md b/docs/development.md index 1f9246a..5883761 100644 --- a/docs/development.md +++ b/docs/development.md @@ -61,6 +61,8 @@ This bumps the build number, archives, and uploads to App Store Connect. Builds | `just generate` | Regenerate Xcode project from `project.yml` | | `just sim` | Build + run on booted simulator (production API) | | `just sim-local` | Build + run on booted simulator (local API) | +| `just sim-fresh` | Same as `just sim`, but uninstalls first to wipe app sandbox (URLCache, UserDefaults, on-disk caches) | +| `just sim-local-fresh` | Same as `just sim-local`, but uninstalls first | | `just device ` | Build + install to plugged-in iPhone | | `just test` | Run tests | | `just format-fix` | Auto-fix formatting | diff --git a/justfile b/justfile index 23e998e..88ff40d 100644 --- a/justfile +++ b/justfile @@ -57,6 +57,27 @@ sim: xcrun simctl spawn "$SIM" log config --subsystem {{bundle_id}} --mode level:debug echo "Installed and launched on simulator (grain.social)" +# Build + install + launch on simulator (production API, fresh — uninstalls app first +# to wipe URLCache, UserDefaults, FeedCache, LabelDefinitionsCache, Documents/Caches, etc.) +sim-fresh: + #!/usr/bin/env bash + set -euo pipefail + SIM=${SIM_UDID:-booted} + xcrun simctl boot "$SIM" 2>/dev/null || true + xcrun simctl bootstatus "$SIM" -b >/dev/null + xcrun simctl uninstall "$SIM" {{bundle_id}} 2>/dev/null || true + SIM_UDID="$SIM" just sim + +# Build + install + launch on simulator (local/dev API, fresh — uninstalls app first) +sim-local-fresh: + #!/usr/bin/env bash + set -euo pipefail + SIM=${SIM_UDID:-booted} + xcrun simctl boot "$SIM" 2>/dev/null || true + xcrun simctl bootstatus "$SIM" -b >/dev/null + xcrun simctl uninstall "$SIM" {{bundle_id}} 2>/dev/null || true + SIM_UDID="$SIM" just sim-local + # Run tests test: set -o pipefail && xcodebuild test -scheme Grain -destination 'platform=iOS Simulator,name=iPhone 17 Pro Max' PRODUCT_BUNDLE_IDENTIFIER={{bundle_id}} 2>&1 | xcbeautify