What worked shipping two SwiftUI apps, written for a coding agent. Paste it into a new chat in an empty folder on a Mac.
Build a native iPhone app with me, running on my phone as fast as possible. If a value below is blank, ask for all the blanks in one short message first.
com.yourname):A free team can’t do push notifications, iCloud or Sign in with Apple. If I need one, tell me before building: the paid team is $99 a year. Free builds also stop opening after 7 days, and only 3 free-team apps fit on a phone at once.
Run every check first. Walk me through only the steps not done, one at a time.
xcodebuild -version.xcodebuild -showsdks lists iOS.xcrun xctrace list devices lists it under Devices (not Offline) with its iOS version. If that’s newer than the SDK, I need a newer Xcode.IPHONEOS_DEPLOYMENT_TARGET to my iPhone’s iOS or lower. Xcode defaults to its own SDK, and the build then can’t find an older phone.SWIFT_VERSION to 6.0 in every target, first thing. New projects start at 5.0, and fixing it later is far harder.project.xcproj, Xcode 27’s readable project file, but never in an older project.pbxproj. Files added to the app folder build automatically.Info.plist keys are build settings now (INFOPLIST_KEY_…). Set ITSAppUsesNonExemptEncryption to NO if the app only uses HTTPS, hashing and the Keychain, or TestFlight testers can’t install it.NSCameraUsageDescription, or the app crashes the moment it asks. Ask at the moment of need, not at launch.DerivedData.noindex/.https://developer.apple.com/tutorials/data/documentation/<path>.json.Check your own work in the simulator before showing me, from the folder with the .xcodeproj. NAME comes from xcrun simctl list devices:
xcodebuild -scheme MyApp -destination 'platform=iOS Simulator,name=NAME' -derivedDataPath DerivedData.noindex build
xcrun simctl boot "NAME" # "current state: Booted" is fine
xcrun simctl install "NAME" DerivedData.noindex/Build/Products/Debug-iphonesimulator/MyApp.app
xcrun simctl launch "NAME" com.example.myapp
xcrun simctl io "NAME" screenshot shot.png
xcrun simctl ui "NAME" appearance dark
Name the simulator: booted can pick another project’s. simctl can’t tap: use XCUITest for taps you repeat, and computer use or a simulator-control MCP server to explore.
Install on the phone with scripts/phone.sh, saved next to the .xcodeproj with APP and BUNDLE set. Keep the phone unlocked. It installs over the old copy, keeping the app’s data. Never uninstall to fix a problem: that erases it.
#!/bin/bash
# Build, install over the old copy, launch, and confirm it stays running.
set -euo pipefail
cd "$(dirname "$0")/.."
APP=MyApp BUNDLE=com.example.myapp OUT=DerivedData.noindex
LOG=$OUT/phone.log; mkdir -p "$OUT"
fail() { grep -E 'error:|ERROR:|FailureReason' "$LOG" | sort -u | head -20 || true; echo "$1 failed. Log: $LOG" >&2; exit 1; }
xcrun devicectl list devices --json-output "$OUT/devices.json" >"$LOG" 2>&1
UDID=$(python3 -c 'import json, sys
d = [x["hardwareProperties"] for x in json.load(open(sys.argv[1]))["result"]["devices"]
if x["hardwareProperties"].get("reality") == "physical"
and x["hardwareProperties"].get("deviceType") == "iPhone"
and x["connectionProperties"].get("pairingState") == "paired"
and x["connectionProperties"].get("tunnelState") != "unavailable"]
print(d[0]["udid"] if d else "")' "$OUT/devices.json")
[ -n "$UDID" ] || { echo "No iPhone connected. Plug it in, unlock it and trust this Mac." >&2; exit 1; }
xcodebuild -scheme "$APP" -destination "id=$UDID" -derivedDataPath "$OUT" \
-allowProvisioningUpdates -allowProvisioningDeviceRegistration build >>"$LOG" 2>&1 || fail Build
xcrun devicectl device install app --device "$UDID" \
"$OUT/Build/Products/Debug-iphoneos/$APP.app" >>"$LOG" 2>&1 || fail Install
xcrun devicectl device process launch --terminate-existing --device "$UDID" "$BUNDLE" >>"$LOG" 2>&1 || fail Launch
sleep 5
RUNNING=$(xcrun devicectl device info processes --device "$UDID" 2>>"$LOG") || fail "Process check"
grep -qF "$APP.app/$APP" <<<"$RUNNING" || {
echo "$APP quit within 5 seconds. Crash reports: xcrun devicectl device info files --device $UDID --domain-type systemCrashLogs" >&2; exit 1; }
echo "$APP is running on the iPhone."
Logs and crashes:
Logger(subsystem: "<bundle ID>", category: "…"). The lines below stream it from the simulator (--level shows .info and .debug), show the phone’s output with Logger included (it runs until the app quits, so not in phone.sh), and list and copy the phone’s crash reports.~/Library/Logs/DiagnosticReports/.xcrun simctl spawn "NAME" log stream --level debug --predicate 'subsystem == "com.example.myapp"'
xcrun devicectl device process launch --console --terminate-existing -e '{"OS_ACTIVITY_DT_MODE": "1"}' --device UDID com.example.myapp
xcrun devicectl device info files --device UDID --domain-type systemCrashLogs
xcrun devicectl device copy from --device UDID --domain-type systemCrashLogs --source FILE.ips --destination .
NavigationStack, List, Form, sheets, tab bars) and go custom only for a reason.Codable structs as JSON in Application Support, written with .atomic, with a version field. Both source apps chose this over SwiftData and Core Data.UserDefaults or files. For a web sign-in, return with ASWebAuthenticationSession, because another app can claim a custom URL scheme.xcodebuild test -scheme MyApp -destination 'platform=iOS Simulator,name=NAME' -derivedDataPath DerivedData.noindex
What has fooled us:
phone.sh’s 5-second check catches this.Ask me before uploading, adding testers or submitting anything to Apple.