Dev.to AI πŸ€– Ai πŸ‘ 0 πŸ“– 15 min read

Two Android iOS ports with an AI agent: 24 days, then 5. The process and what broke

The most valuable thing I got from porting my first Android app to iOS wasn't the iOS app itself. It was everything I could reuse when I started the second one. I'm an independent app developer. I have two language-lear

The most valuable thing I got from porting my first Android app to iOS wasn't the iOS app itself. It was everything I could reuse when I started the second one.

I'm an independent app developer. I have two language-learning apps on Google Play, one for Hebrew and one for Korean. Both are built with Kotlin and Jetpack Compose, with roughly 46,000 lines of Kotlin each. This autumn I ported both to native Swift and SwiftUI using Claude Code to write most of the code.

The Hebrew app took 24 days from the first commit to the build I submitted to the App Store. The Korean app took five days of coding and 140 commits. It was live 14 days after the first commit.

I have a simple principle: generate value, not lines of code. I don't particularly care how many lines an AI agent can write in an hour. I care whether the resulting app works, whether its behaviour is correct, and whether I can maintain it afterwards.

What made the second port faster wasn't simply the ability to generate Swift code. I already had a working architecture, a documented process, reusable components and, perhaps most importantly, a list of mistakes I didn't want to make twice.

Here is what that process looked like, with numbers from Git, actual task definitions, verification scripts and examples of bugs that passed the tests anyway.

Port 1: Hebrew Port 2: Korean
Android code at the start 46k lines of Kotlin, 46 unit tests 47k lines of Kotlin, 548 unit tests
Written description of the Android app 9 documents, ~4,000 lines 10 documents, ~6,100 lines
Plan 106 tasks in 6 phases 120 tasks in 10 phases
Code 24 days to the submitted build 5 days, 140 commits
Swift at release ~37k lines + 22k lines of tests ~41k lines + 25k lines of tests
Tests on iOS 1,324 at release, ~2,000 now 1,787 Swift Testing + 96 UI tests

The target stack

Both iOS apps use the same setup, and the second one reused a lot of the first:

  • Swift 6 language mode with complete strict concurrency, SwiftUI, iOS 16 minimum (so ObservableObject, not @Observable).
  • Three local Swift packages: Core (domain logic on plain Foundation, no UI), Data (GRDB storage) and UI (design system and screens).
  • GRDB instead of Room, RevenueCat on both platforms, AdMob rewarded ads with Google's consent form, Firebase Analytics.
  • One composition root that builds an AppEnvironment of services. No DI framework, no singletons.

I went native rather than Kotlin Multiplatform or Flutter because both Android apps work and I didn't want to touch them. The cost is two codebases to keep in step.

Step 1: describe the Android app before writing any Swift

Before the first line of Swift, agents read the Android app layer by layer and wrote down what it does. For the Korean app that became ten documents:

  • overview (single Activity, manual DI) and an inventory of every file;
  • data layer: 7 Room databases, Firestore, DataStore, and the target SQLite schema for iOS;
  • domain logic: formulas, limits, spaced repetition, XP and streaks, plus a table of which Android tests to port;
  • presentation, in two parts: the shell (33 navigation routes, home, paywalls) and the features;
  • resources and assets, with audio coverage checked by scripts;
  • platform integrations: every SDK and system API, and how the Hebrew iOS app had already solved it;
  • build config;
  • risks and open questions: Android bugs not to port, dead code, and decisions I had to make.

Every claim points to a file and line in the Kotlin code. When the per-layer results were merged, the weightiest claims were checked against the code again and marked [verified].

The decisions part mattered more than I expected. Before any code, I decided to drop Firestore on iOS and bundle all content, to show rewarded ads only (the Android interstitial code turned out to be dead anyway), and not to port a list of known Android bugs.

What went wrong in port 1: porting from prose drifts

In the Hebrew port the agent ported logic from the documents, and on day 4 an audit against the real Kotlin found the drift:

  • The spaced-repetition algorithm (an SM-2 variant) skipped recalculating the ease factor in one branch. The analysis called something "the only exception", and the agent applied it to the wrong branch: the sentence was about a different transition.
  • The answer-options generator had four differences from Android. For example, it cut strings to 16 characters in both branches, where Android cuts the first 12 in one branch and the last 16 in the other, and its length-penalty threshold was 20 where Android's is 18.
  • The distractor word pools had been "reconstructed" from the description. The real lists (499, 686, 684, 632 and 338 words) were then copied over verbatim.

Nothing crashed. The app would simply have behaved a little differently from Android, and nobody would have noticed for a while.

So in port 2 the documents stayed the map, but each task cites both the document section and the Android file and line. Anything deterministic gets checked against output produced by the Kotlin code itself (more on that below).

Step 2: a plan made of tasks an agent can finish in one session

The plan for the Korean app is 120 tasks in 10 phases. The phases are vertical slices (skeleton, alphabet, writing, lessons, trainer, review, and so on) with a dependency graph. Every task has the same shape. Here is one, shortened and translated:

### P3-05 β€” Seeded PRNG: bit-exact port of kotlin.random.Random

Depends on: P0-02
Reuse from the Hebrew app: nothing (it has no seeded PRNG)

Scope:
- KotlinRandom: RandomNumberGenerator in Core/Support, a bit-exact port of XorWowRandom
- init(seed: Int64) splits the seed like Random(seed: Long): low and high 32 bits
- nextInt(until:) with the same power-of-two branch and the same rejection loop
- shuffle/shuffled in Kotlin's order: for i in lastIndex downTo 1 { j = nextInt(i + 1); swap }
Goldens come from Kotlin: a throwaway JUnit test in the Android repo prints JSON.

Source: analysis/02 Β§6.5, plan/01-tech-mapping Β§2
Android bugs fixed: none
Tests: seeds 0, 1, 42, -1, Int64.max, Int64.min, 1_729_000_000_000 β€” first 100 nextInt(),
nextInt(until:) for 2, 3, 4, 7, 10, 16, 40, shuffled(0..<10). All bit-exact.

The "Android bugs fixed" line is often not empty. For example, 21 of 40 letter examples in the Android app had no audio, and the "listen" button just disappeared without any test noticing. On iOS a test now lists the 21 missing clips explicitly, so a new gap fails the build.

The rules for the agent were short:

  • One task per session, one commit. The commit also updates the plan with a "how it was done" note on any deviation. There are more than a hundred of those notes now.
  • Behaviour comes from the analysis, code from the Hebrew iOS app. The plan has a file-by-file reuse map: 11 files as they are, 24 adapted, 2 written from scratch, and 1 not reused.
  • Android tests move with the logic. The plan expected about 500 of the 548 Android unit tests to be ported.
  • Open questions go to a file, not into the chat.

The plan estimated 19.5 working days. The code took 5. Most of the difference came from the reuse map and from lessons the first port had already paid for.

Step 3: gates that don't trust the agent

The agent writes code that compiles and passes its own tests. That is not the same as code that keeps your architecture. So the rules live in shell scripts that run before every commit, locally and in CI:

  • no @Observable (iOS 16), no static var (no global mutable state);
  • services are created only in the composition root;
  • no Swift randomness in the lesson and quiz domain (see below);
  • no Character or String.Index in the Korean text code;
  • analytics events only from one catalog;
  • module boundaries, hardcoded colours and font sizes, UI strings outside the String Catalog;
  • the privacy manifest, the release configuration, and no debug symbols in the Release binary.

A lint is just grep with a reason:

echo "[6/10] lesson and quiz domain: KotlinRandom only"
randoms=$(grep -rnE --include='*.swift' \
  'SystemRandomNumberGenerator|\.shuffled\(|\.shuffle\(|\.randomElement\(|\.random\(in:' \
  Packages/HangulCore/Sources/HangulCore/Domain/Lessons \
  Packages/HangulCore/Sources/HangulCore/Domain/Quizzes \
  | grep -vE '^[^:]+:[0-9]+:[[:space:]]*//' || true)
[[ -z "$randoms" ]] || { echo "$randoms"; status=1; }

Why a script for module boundaries? Because the compiler can't enforce them here. import SwiftUI compiles fine inside the Foundation-only Core package: the package builds for macOS too, and SwiftUI ships in the macOS SDK.

The scripts caught real things. In one task the agent hid a debug menu behind a static flag, and the global-state rule failed. In another it wrote a self-recursive forUITest() helper, and the first full run crashed.

The first port also left a list of 55 fixes, and the second plan turned them into rules up front. Any tappable card goes through one shared component with .contentShape over its whole area, not onTapGesture on the text. Every call-to-action has a UI test or a router test that it goes where it should, because the Hebrew app had dead buttons and links that opened the wrong tab. Sheet heights are not measured with GeometryReader plus onAppear.

What I actually run in CI

A full run (lints, package tests, Debug, Staging and Release builds, UI tests, iPhone SE and Pro Max screens) took about 23 minutes. Running it after every task was too slow, so the rule became: lints, package tests and a Debug build per task, and the full run at the end of each phase and before a release. Later I split the UI tests across three simulator clones, and the everyday run went from about 27 minutes to 11–12.

All of this runs locally. The Hebrew repo's GitHub Actions workflow ran 84 times and never went green (the last problem: the hosted runner didn't have the Xcode version the project needed), and one macOS run cost about 490 minutes of Actions quota. It is now manual-only, and the local script is the real gate.

The bug that would have shipped silently: Kotlin's Random

The Korean app generates lessons with kotlin.random.Random(seed), where the seed is the current time in milliseconds. The seed is saved, so an interrupted lesson resumes with the same questions.

The analysis suggested "a seeded PRNG on iOS, e.g. splitmix64 or xorshift". That would have worked, passed its own tests, and produced different lessons on iOS than on Android for the same seed. Nothing would have failed.

Instead the plan asked for a bit-exact port of XorWowRandom from the Kotlin 2.1 standard library (excerpt showing the seeded state and nextInt(); the full implementation also provides the protocol’s next() method and bounded integer generation):

/// Bit-exact port of kotlin.random.Random(seed: Long), XorWowRandom from Kotlin 2.1.
public struct KotlinRandom: RandomNumberGenerator, Sendable {
    private var x, y, z, w, v, addend: UInt32

    public init(seed: Int64) {
        let seed1 = UInt32(truncatingIfNeeded: seed)
        let seed2 = UInt32(truncatingIfNeeded: seed >> 32)
        x = seed1; y = seed2; z = 0; w = 0
        v = ~seed1
        addend = (seed1 << 10) ^ (seed2 >> 4)
        for _ in 0..<64 { _ = nextInt() }  // same warm-up as the stdlib
    }

    public mutating func nextInt() -> Int32 {
        var t = x
        t ^= t >> 2
        x = y; y = z; z = w
        let v0 = v
        w = v0
        t = (t ^ (t << 1)) ^ v0 ^ (v0 << 4)
        v = t
        addend &+= 362_437
        return Int32(bitPattern: t &+ addend)
    }
}

The expected values don't come from the agent. A throwaway JUnit test runs once in the Android repo and dumps JSON. It's never committed there; its source is kept in the iOS repo with instructions for re-running it:

val seeds = listOf(0L, 1L, 42L, -1L, Long.MAX_VALUE, Long.MIN_VALUE, 1_729_000_000_000L)
// for each seed: 100 Γ— nextInt(), nextInt(until) for 7 bounds, shuffled(0 until 10),
// and a "mixed" sequence: shuffled, randomOrNull, shuffled on one stream, like the generator
val ints = Random(seed).let { r -> List(100) { r.nextInt() } }
@Test(arguments: seeds)
func firstHundredInts(seed: Int64) throws {
    let entry = try #require(Self.golden.seeds.first { $0.seed == String(seed) })
    var random = KotlinRandom(seed: seed)
    #expect((0..<100).map { _ in random.nextInt() } == entry.nextInt)
}

One more trap: even with the right generator, Swift's Array.shuffled(using:) uses a different algorithm and consumes a different number of random values, so the sequences would silently diverge after the first shuffle. Hence kotlinShuffled, and the lint above that bans Swift's own randomness in the lesson domain. The next task, the lesson generator, now matches Android question for question.

Strings had the same kind of problem. Kotlin indexes strings in UTF-16 code units, while a Swift Character is a grapheme cluster. The Korean text code works on [Unicode.Scalar], a lint bans Character and String.Index there, and a test pins the indices with an emoji in front of a syllable.

What broke anyway

Tests passed for all of these, at least at first.

An iOS 26 crash in onboarding. In my onboarding screen on iOS 26, an animated insertion involving a main-actor-isolated ForEach closure crashed during rendering. The fix was to build onboarding without ForEach.

A cancelled task lost a seed. A daily counter seeded itself on first use. When the first caller was a SwiftUI .task that got cancelled, GRDB threw CancellationError and the seed was never written. Seeding is now a single detached task that every caller awaits.

One bad row rolled back a whole sync. The production API returned two words with the same category and Hebrew spelling (a content mistake on the server). A UNIQUE index threw, the whole sync transaction rolled back, a try? swallowed the error, and the vocabulary screen showed a spinner forever. Now duplicates are ignored on insert, and I treat try? in sync code as a bug.

A config key that was never wired. The "free story" gate was implemented and tested by story ID, but the FREE_STORY_ID build setting never made it into Info.plist or any .xcconfig. The lookup returned nil, so every story was locked. The unit tests injected the value, so they passed.

SwiftUI identity. A wrong answer resets a word to step 1. If you were already on step 1, the "new" card had the same id, SwiftUI kept the old view, and the session froze. Elsewhere, a sheet driven by two separate @State writes opened empty on the first tap; .sheet(item:) fixed it.

Hebrew text. Mixed Hebrew and English in one line needed bidi isolates (LRI/PDI) to render correctly. Distractors that differed from the right answer only in vowel marks showed up in about 10% of runs for 21 of 230 words. And a validator for word explanations from the server rejected many correct responses over vowel marks, so the app threw away a successful 200 and silently fell back to an offline transliteration.

Notifications. Android could pick the message when the reminder fires. iOS won't wake the app to choose, so the iOS planner books a week of UNCalendarNotificationTrigger reminders ahead, with the fire hour kept in local time across daylight-saving changes. Porting this logic also exposed an Android bug: reminders read the stored streak, not the live one.

StoreKit testing. A local .storekit configuration never reached the purchase-success screen with RevenueCat, because it lacked the StoreKit Testing certificate setup. I tested purchases in the sandbox on a device instead and removed the file. Restore now always shows a result, because a silent restore like Android's is a review risk under Guideline 3.1.1.

Privacy manifests. In my Firebase SwiftPM setup, I had to account for missing privacy-manifest declarations in the app’s own manifest. In my AdMob setup, the SDK privacy declarations included the device ID as tracking data even though my app never requested tracking permission. And ad_click turned out to be a reserved Firebase event name.

Toolchain. SwiftPM kept a stale cached module of one local package inside another and failed with "cannot find type"; the CI script now wipes the package build cache when the source file list changes. In an .xcconfig, // starts a comment, which truncated the AdMob unit IDs until I used $(SLASH). An open Xcode deleted Package.resolved.

Flaky tests. Badge tests failed only after 22:00, because the real clock unlocked a "night owl" badge; the clock is now injected. Waits that counted Task.yield() calls failed about one run in twenty. An unsynchronised test fake crashed with SIGSEGV about one run in five.

What the agent did and what I did

The agent wrote the analysis, the plan, the code, the tests, the lint scripts, the privacy inventory and the commit messages. 142 of the 144 commits in the Korean repo are co-authored by Claude; the other two are a merge and a revert. In the second port that was Claude Opus 5.5 in Claude Code.

My part:

  • Decisions. What to drop (Firestore and interstitials), what to leave out of the initial iOS release (Sori, which I cut mid-port), and which Android behaviours needed fixing rather than copying.
  • Everything visual, on a real device. The agent doesn't take screenshots, which saves a lot of tokens; each phase ends with a "what the owner should check" list instead. The final checklist covers 18 areas. A few examples: set the date to October 31 and check that the seasonal Halloween item comes first; confirm the review prompt shows every time in Debug and never in TestFlight; generate the Privacy Report from the archive; make a sandbox purchase and a restore on a device; open the consent form over an EU VPN.
  • Store risks the code can't see. Onboarding mentioned BTS, BLACKPINK and Squid Game as reasons to learn Korean. They came out before submission (Guideline 5.2, third-party trademarks).

The agent also got facts wrong in ways no test would catch. The analysis said 37 image assets were in use when it was 28. The Home screen's Premium button was deferred from phase 1 to phase 7 and then forgotten until a routing audit found it. That's why the documents mark what was verified, and why plan corrections ship in the same commit as the task.

Five days of coding doesn't mean five days to market

The Hebrew app was my first experience publishing an app on the App Store. I had already built and published Android apps, but this was new territory for me.

Apple asked for more information about the app's functionality and a screen recording. From a developer's perspective, the frustrating part was that I could investigate a bug, change the code and run the tests again. Once the app was in review, there was much less I could do. The waiting was the hardest part for me. I wrote more about that experience on my Hebrew learning app's website.

That first submission was useful preparation for the second. Before submitting the Korean app, I removed references to third-party trademarks from onboarding, made sure Restore Purchases always provided visible feedback, checked the Terms of Use and Privacy Policy links on the app's website, and added a CI check for the export-compliance key in Info.plist.

I finished the code on October 28. The app went live on November 7.

That's why I distinguish between five days of coding and 14 days from the first commit to a live app. A customer cannot download a successful build on my Mac. They need an app in the store that they can actually install and use. For me, that's the result that matters.

If you're about to port your own app

  • Write the Android app down first, with a file and line for every claim, and verify the important ones against the code.
  • Make tasks small enough for one agent session, each with its source, its tests and a "done when".
  • Port the tests together with the logic. For anything deterministic (random generators, schedulers, scoring), generate the expected values from the original Kotlin code, not from the agent.
  • Put your architecture rules in scripts. The compiler won't enforce your module boundaries, and the agent won't remember them.
  • Treat try? in sync and storage code as a bug. Silent fallbacks caused my worst bugs.
  • Check config, not just code. Build settings, Info.plist keys and the release configuration can pass every unit test and still be wrong.
  • Keep the visual checks human. Budget the time for device checks, TestFlight and review.
  • Put shared pieces in packages. That is what made the second port five days instead of twenty.

Both apps are on the App Store: Learn Hebrew – Read & Speak and Hangul Hero: Korean Alphabet & Phrases.

I now offer the same approach as a fixed-price service for other developers: native Android β†’ iOS ports. If you have tried a similar port, I would be particularly interested in how you verified behavioural parity between platforms. Questions about the process are welcome too.

πŸ“° Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.