Dan Romero

Start an iOS app fast

Updated

What worked shipping two SwiftUI apps, written for a coding agent. Paste it into a new chat in an empty folder on a Mac.

1336 words

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.

Values

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.

1. My setup

Run every check first. Walk me through only the steps not done, one at a time.

  1. Install Xcode from the Mac App Store. It needs about 30 GB. Check with xcodebuild -version.
  2. Open Xcode once and add the iOS platform when asked. Check that xcodebuild -showsdks lists iOS.
  3. Sign in under Xcode → Settings → Apple Accounts. Step 4’s Team menu then lists my team.
  4. File → New → Project → iOS → App. Team: mine. Organization Identifier: my bundle ID prefix. Interface: SwiftUI. Testing System: Swift Testing with XCTest UI Tests. Storage: None. Save in this folder (Xcode adds a subfolder and a git repo). With computer use, do it yourself.
  5. Connect the iPhone by cable, unlock it and tap Trust. Check that 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.
  6. On the phone, Settings → Privacy & Security → Developer Mode. It only appears after step 5, and turning it on restarts the phone.
  7. After the first install, if iOS asks: Settings → General → VPN & Device Management, and trust the developer.

2. Project rules

3. Build loop

  1. The first screen on my phone within 30 minutes, in SwiftUI.
  2. The main loop, end to end, with real saved data.
  3. The rest, one feature at a time, installed on the phone after each.

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:

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 .

4. Design

5. Data

6. Tests

xcodebuild test -scheme MyApp -destination 'platform=iOS Simulator,name=NAME' -derivedDataPath DerivedData.noindex

What has fooled us:

7. Sharing with TestFlight (paid team)

Ask me before uploading, adding testers or submitting anything to Apple.

  1. Create the app in App Store Connect → Apps → New App, with the same bundle ID.
  2. In Xcode: Product → Archive, then Distribute App → TestFlight & App Store.