<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Building with agents | Zubin Khavarian</title><description>Every part of Zubin Khavarian&apos;s series &quot;Building with agents&quot;, as it publishes.</description><link>https://zubin.dev/</link><language>en-us</language><atom:link href="https://zubin.dev/rss/building-with-agents.xml" rel="self" type="application/rss+xml"/><lastBuildDate>Mon, 30 Nov 2026 11:00:00 GMT</lastBuildDate><image><url>https://zubin.dev/avatar.png</url><title>Building with agents | Zubin Khavarian</title><link>https://zubin.dev/</link></image><item><title>Porting Two Web Apps to SwiftUI with an Agent</title><link>https://zubin.dev/blog/porting-web-apps-to-swiftui/</link><guid isPermaLink="true">https://zubin.dev/blog/porting-web-apps-to-swiftui/</guid><description>In one week, two of my web learning apps became native SwiftUI apps, and the web versions were deleted on day two. The part that made it work wasn&apos;t the model. It was a port map, a clear source of truth, and knowing what to rethink instead of translate.</description><pubDate>Mon, 30 Nov 2026 11:00:00 GMT</pubDate><content:encoded><![CDATA[<p>Two of my learning apps started life on the web: a math drill and a music-reading game. They were React apps, and they worked. But the people who’d use them most, children on family iPads, find apps through the App Store, and a web app never feels quite at home there.</p>
<p>So in late September I ported both to native SwiftUI, working with a coding agent. The first native commit landed on September 23. On September 24 I deleted the web apps.</p>
<figure class="sketch not-prose"><div class="sketch-frame"><p><em>Figure: Bars of Swift lines per app: Treble Trouble 12,995 lines and 55 commits since September 23; Mathness 12,294 lines and 40 commits since September 24. Below: the web apps were removed on September 24 in one commit of 290 files and 44,341 lines. <a href="https://zubin.dev/blog/porting-web-apps-to-swiftui/">See the drawing in the post.</a></em></p></div><figcaption>Two native apps, about 25,300 lines of Swift, started a day apart. The web versions were deleted on day two.</figcaption></figure>
<p>This isn’t a post about how clever the agent was. It’s about the few decisions that made a fast port safe, and the ones I’d make again.</p>
<h2 id="write-the-port-map-down">Write the port map down</h2>
<p>The single most useful thing was a <strong>port map</strong>: for every web file, the Swift file it becomes. Not in my head, not in a planning chat, but in each app’s <code>AGENTS.md</code>, the notes file the agent reads before it touches anything.</p>
<figure class="sketch not-prose"><div class="sketch-frame"><p><em>Figure: A two-column map from web files to Swift files: lessons.ts to Learn/Lessons.swift, problems.ts to Learn/Problems.swift, rhythm.ts to Music/Rhythm.swift, next-question.ts to Game/Question.swift, staff-symbol.tsx to the Components/Staff folder, and session.ts to State/Session.swift. <a href="https://zubin.dev/blog/porting-web-apps-to-swiftui/">See the drawing in the post.</a></em></p></div><figcaption>Part of Treble Trouble&#39;s port map. Every web file has a named Swift home, written down where the agent reads it.</figcaption></figure>
<p>A port map does three jobs at once. It tells the agent where new code belongs, so the Swift project ends up organized rather than accreted. It lets a reviewer (me) check a change against the original file it’s meant to replace. And it makes the port finite: when every row has a Swift home, the port is done.</p>
<h2 id="one-source-of-truth-and-a-way-back">One source of truth, and a way back</h2>
<p>Running two versions of the same app in parallel is where ports go to die: every fix has to be made twice, and they drift. So each app’s notes say it plainly: the web app is gone, and <strong>the Swift code is the source of truth.</strong></p>
<p>Deleting the web apps on day two sounds reckless, but it wasn’t, because nothing was really lost. The notes record the exact commit to recover any file from:</p>
<pre class="astro-code astro-code-themes zubin-light zubin-dark has-copy-btn" tabindex="0" data-language="sh"><code><span class="line"><span>git</span><span> show</span><span> bec9aae8:apps/treble-trouble/src/rhythm.ts</span></span></code></pre>
<p>That one line is what made deleting 290 files comfortable. When the agent (or I) wanted to check how the web version handled something, the original was one command away, and there was never a second copy to keep in sync.</p>
<h2 id="keep-the-names">Keep the names</h2>
<p>A few things were kept deliberately identical: lesson ids, the names of the keys that store progress, and the translation catalogs, which moved over as the same JSON files (<code>L(&quot;English message&quot;)</code> looks up the same strings on both platforms).</p>
<p>Keeping names stable kept the port map honest. A lesson id means the same lesson on both sides of the map, so a test, a screenshot flag or a note in the docs doesn’t need translating.</p>
<h2 id="translate-the-logic-rethink-the-platform">Translate the logic, rethink the platform</h2>
<p>The logic moved over almost line for line: how questions are generated and how lessons unlock. That’s the part an agent is very good at, and the part where a port map keeps it faithful.</p>
<p>The parts that touch the platform are different, and they’re where I spent my own attention:</p>
<figure class="sketch not-prose"><div class="sketch-frame"><p><em>Figure: Three columns. Carried over: lesson and question logic, lesson ids, storage key names, translation catalogs. Rethought: one audio callback, tab bar navigation, StoreKit and the grown-up gate. Left behind: desktop keyboard answers, the rotate-your-device prompt, top-edge mode tabs, the paper grain texture. <a href="https://zubin.dev/blog/porting-web-apps-to-swiftui/">See the drawing in the post.</a></em></p></div><figcaption>The logic moved over almost line for line. The parts that touch the platform were redesigned, and a few web-only pieces were simply dropped.</figcaption></figure>
<ul>
<li><strong>Audio.</strong> The web music app ran everything through one <code>AudioContext</code>. The iOS version keeps that idea and routes every sound through <a href="https://zubin.dev/blog/one-sample-clock/">one render callback</a>, rather than translating it into a handful of separate players.</li>
<li><strong>Navigation.</strong> The web apps had mode tabs across the top and a big title menu. The native apps use a tab bar and a splash screen, because that’s what an iPad app is.</li>
<li><strong>Everything the web didn’t need.</strong> In-app purchases through StoreKit, a <a href="https://zubin.dev/blog/learning-apps-collect-nothing/">grown-up check in front of every link</a>, optional player profiles, App Store screenshots.</li>
</ul>
<p>And some things were simply left behind: answering questions with the keyboard (a desktop-only feature on the web), a “please rotate your device” prompt (iOS just rotates), and a paper grain texture.</p>
<h2 id="what-the-agent-needed-from-me">What the agent needed from me</h2>
<p>Looking back, the agent needed the same things a new teammate would:</p>
<ul>
<li><strong>A map of where things go</strong>, written down.</li>
<li><strong>A clear rule about which version is real.</strong></li>
<li><strong>A way to look at the old code</strong>, without keeping it alive.</li>
<li><strong>Stable names</strong>, so references mean the same thing everywhere.</li>
<li><strong>Judgement on the platform-specific parts</strong>, which is where “translate this file” stops being the right instruction.</li>
</ul>
<p>The logic took days. The judgement calls about audio and navigation are what made the results feel like iPad apps rather than web pages in a frame.</p>]]></content:encoded><dc:creator>Zubin Khavarian</dc:creator><category>ios</category><category>swift</category><category>agents</category></item></channel></rss>