Building a Cross-Platform AI Chat App With Cursor + Kotlin Multiplatform (KMP)

Original on Medium

I’ve been an iOS developer for years, deeply familiar with Swift, SwiftUI, and Apple’s ecosystem — but with very limited experience on the Android side. Historically, building a cross-platform app felt intimidating: different toolchains, different languages, different UI frameworks.

This changed dramatically when I started using Cursor’s AI Agent together with Claude-4.5-Sonnet.

With these AI tools, I discovered that even as an iOS-focused engineer, I could quickly build a fully functional Android + iOS app using Kotlin Multiplatform (KMP). The AI agents filled every knowledge gap — Gradle, Compose, Kotlin idioms, Android permissions — and guided me through the entire cross-platform workflow.

For the first time, I felt truly empowered:
AI made cross-platform development not only possible, but enjoyable.

In this article, I’ll share how I used Cursor + Claude-4.5-Sonnet to develop a Generative AI Chat App for both Android and iOS, powered by Ollama as the model backend.

🚀 Why KMP + Cursor + Claude-4.5-Sonnet Makes Development So Fast

As an iOS developer stepping into Android territory, this combination was perfect:

  • Cursor AI Agent understood the project tree, Gradle configs, Kotlin code, Swift code, and build logs, fixing things automatically.
  • Claude-4.5-Sonnet provided deeper reasoning — architecture decisions, explanations, and multi-file refactoring plans.
  • Kotlin Multiplatform let me write shared logic once and keep native UI on both platforms.

This setup eliminated the biggest barrier: the mental overhead of learning a whole new mobile ecosystem at once.

Instead of spending days understanding Compose or Gradle, I simply asked the AI agent:

“Explain this build error like I’m new to Android.”

and it did — clearly and patiently.

1. 🎯 Generate a New KMP Project

The easiest way to start is by using the official Kotlin Multiplatform Wizard:

👉 https://kmp.jetbrains.com/?android=true&ios=true&iosui=compose&includeTests=true

Just open the link, select your options, and download the generated project directly.
There’s no complicated setup, no scaffolding script, no Gradle gymnastics.

Everything works out of the box.
The shared module, the Android app, and the iOS app are already wired together.

You get:

  • A shared KMP module containing the business logic
  • An Android app using Jetpack Compose
  • An iOS app using SwiftUI

And one of the biggest advantages today:

You can run the iOS app directly inside Android Studio using the built-in iOS simulator integration.

This makes cross-platform development feel surprisingly unified — especially for someone like me who comes primarily from an iOS background.

2. 🛠 Build the Android App

A single command builds Android:

./gradlew :composeApp:assembleDebug

Then I run it in Android Studio — no Android experience needed.

Whenever I hit Gradle errors (which used to terrify me), I highlighted the stack trace and asked Cursor:

“Fix this Gradle error and update my KMP config automatically.”

Claude-4.5-Sonnet offered explanations so I could learn what was happening, without stalling progress.

3. 🛠 Build & Run the iOS App (Also in Android Studio)

Traditionally, iOS apps had to run in Xcode. With modern KMP:

  • Open Xcode → run the app
  • Or simply run the iOS Simulator directly from Android Studio

This was surreal the first time I tried it.
No context switching.
No re-opening projects.
Just hit Run in Android Studio and see the iOS UI.

As an iOS engineer, this made Android Studio feel like home.

4. 🤖 Building the Shared AI Chat Logic

The prompt for Cursor is like:

To write an AI chat app using:

JSON request:

{
"model": "qwen3:30b",
"prompt": "Why is the sky blue?",
"stream": false
}

To generate the shared API service, I asked Cursor:

“Create a KMP Ktor client with a generateResponse(prompt) function that posts to /api/generate on the configured host.”

Cursor wrote the entire module.
Claude reviewed it and improved the architecture.

As someone new to Android networking and Ktor, this was a massive productivity boost.

The settings screen generated by Cursor

5. 🧩 Solving Real Problems Using Cursor + Claude

The first iteration of generative code had two issues:

Problem 1 — Android blocks cleartext HTTP

Cursor auto-generated:

  • network_security_config.xml
  • Updated Android Manifest

Claude explained why Android works this way.

Problem 2 — Chunked responses from Ollama

I found the response messages were always empty. After debugging, the response was a chunked. I didn’t find a way to put Transfer-Encoding = chunked like Postman did. However, Cursor helped me a lot.

Cursor updated the Ktor client to buffer chunks.
Claude improved JSON parsing to handle malformed streams.

Together, they turned a tricky cross-platform networking issue into a one-prompt solution.

6. ⚙️ Add Additional feature

After testing, I expected to add a new feature to make the app better.

The app stores:

  • API host
  • Selected model

Cursor built a shared SettingsRepository using Multiplatform Settings.
Claude suggested exposing it through a shared ViewModel for cleaner use across Compose and SwiftUI.

7. 🎨 Build the UI for Android and iOS

Android: Jetpack Compose

Cursor generated:

  • ChatScreen
  • Input bar
  • Message list
  • ViewModel connections

As someone new to Compose, this helped me understand the structure quickly.

iOS: SwiftUI

Claude produced:

  • ChatView
  • A SwiftUI wrapper for the KMP ViewModel
  • Async message sending logic

Result: Both platforms feel fully native.

8. 🎉 Final Result

Using Cursor + Claude-4.5-Sonnet, even as an iOS-only developer, I built:

  • A native Android app
  • A iOS app
  • Both powered by shared Kotlin logic
  • With persistent settings
  • With Ollama as the model backend
  • And a clean architecture generated and refined by AI

This was the first time I truly felt that AI expanded my abilities as a developer — not just autocomplete or code suggestions, but acting as a real, intelligent collaborator.

The iOS App

📝 Final Thoughts

As an iOS engineer with limited Android background, I always felt the cross-platform world was too fragmented and too complicated.

But Cursor + Claude-4.5-Sonnet + KMP completely changed that.

  • KMP gives you shared logic.
  • Cursor gives you project-wide intelligence.
  • Claude-4.5-Sonnet gives you beautiful architecture and explanations.

Together, they unlock a new way to build mobile apps — fast, cross-platform, and AI-accelerated.

Comments