Skip to content
STACK IT FAST

Native iOS + Android (SwiftUI + Jetpack Compose, Shared Schema)

Curated rule Mobile App Updated Oct 2026 Which file does my tool read?
swiftui-compose-native.md

Rules for native apps per platform: SwiftUI with SwiftData on iOS, Jetpack Compose with Room on Android, one shared OpenAPI or protobuf schema with codegen, and real-device CI per platform.

Formats
4 files
AGENTS.md
40 lines
CLAUDE.md
14 lines
Languages
Swift, Kotlin
Updated
Oct 2026
Used by
1 project
Install

Writes .claude/skills/swiftui-compose-native/SKILL.md

$ curl -s --create-dirs -o .claude/skills/swiftui-compose-native/SKILL.md https://stackitfast.com/rules/swiftui-compose-native/SKILL.md

Rule files

AGENTS.md· 40 lines · 3.0 KB
1# Project Architecture & Guidelines (SwiftUI + Jetpack Compose, Shared Schema)
2
3## 1. System Architecture
4- **iOS**: Swift 6 language mode with strict concurrency, SwiftUI for UI, SwiftData (or Core Data for existing stores) on device, Swift Testing for tests.
5- **Android**: Kotlin 2 with the K2 compiler, Jetpack Compose for UI, Room on device, Hilt for dependency injection, coroutines and Flow for async.
6- **Shared contract**: One OpenAPI or `.proto` schema in `schema/`; Swift and Kotlin models and clients are generated from it on every build. Nothing else is shared between platforms.
7- **Auth**: Sign in with Apple and Android Credential Manager (passkeys first), only where accounts exist.
8- **Releases**: Each platform has its own CI, signing and staged rollout.
9
10## 2. File Layout
11- `ios/`: Xcode project; `Features/<workflow>/` (views, view models, tests), `Persistence/`, `Generated/` (do not edit).
12- `android/`: Gradle project with version catalogs; `feature/<workflow>/`, `data/`, `generated/` (do not edit).
13- `schema/`: The contract plus the codegen scripts both platforms call.
14- Platform extensions (widgets, watch apps, Wear OS tiles) live beside the app in each platform project.
15
16## 3. Platform Rules
17- Follow each platform's conventions instead of a shared abstraction: Observation (`@Observable`) on iOS, `ViewModel` + `StateFlow` on Android.
18- Views are functions of state. Side effects live in view models or repositories, never in view bodies or composables.
19- On-device stores are the source of truth for offline features; network results are written to the store and the UI observes the store.
20- A model change starts in `schema/`. Regenerate, then fix the compile errors on both platforms in the same PR.
21
22## 4. Concurrency & Performance
23- iOS: no `@unchecked Sendable` or `nonisolated(unsafe)` without a comment explaining why; UI state is `@MainActor`.
24- Android: never block the main thread; database and network calls run on `Dispatchers.IO` through repositories.
25- Profile with Instruments and the Android Studio profiler before optimising; record the numbers in the PR.
26
27## 5. Coding Standards
28- SwiftLint and ktlint (or detekt) run in CI with zero warnings.
29- Generated code is never hand-edited; change the schema or the generator.
30- No cross-platform UI layer on top of native code; you chose native for the platform.
31
32## 6. Testing Conventions
33- iOS: Swift Testing for logic, `#Preview` for every screen state, XCUITest on core flows.
34- Android: JUnit and Turbine for view models and flows, Compose UI tests on core flows, Roborazzi or Paparazzi for screenshots.
35- Real-device runs per release (a device farm or physical devices) for flows that touch sensors, background work or extensions.
36
37## 7. Git Workflow & PR Conventions
38- Conventional Commits with the platform in scope: `feat(ios): home screen widget`, `fix(android): sync retry backoff`.
39- Schema changes touch both platforms in one PR; platform owners review their side.
40- Release branches per platform; staged rollouts with a halt threshold on crash rate.

Works with Cursor · Claude Code · Windsurf · AGY

Architecture notes

Architecture Overview

Guidelines for native apps on both platforms: SwiftUI and SwiftData on iOS, Jetpack Compose and Room on Android, and a single shared schema that generates the models and clients for both.

Key Advantages

  • Each platform at its best: platform idioms, platform tooling and platform extensions without a cross-platform layer in the way.
  • One contract: a model change starts in the schema and becomes a compile error on both platforms, which is the feedback loop an agent needs.
  • Self-contained projects: an agent can read and change one platform without loading the other.

Frequently asked questions

When is fully native the right call over React Native or Expo?

When the product is the platform integration itself: widgets, watch and wear apps, health and sensor data, heavy background processing, or platform UI that has to feel exactly native. For a typical consumer or companion app, a shared TypeScript codebase is still faster for an agent to work in.

Why share only a schema instead of business logic (for example with Kotlin Multiplatform)?

A generated schema is the smallest shared surface that keeps both platforms honest, and each project stays readable in one sitting. Sharing logic through a bridge is worth it only when that logic is large and stable; it adds a third build system the agent has to understand.

Does this AGENTS.md work with Cursor, Claude Code and Windsurf?

Yes. AGENTS.md is the cross-tool standard read by Cursor, Claude Code, Windsurf, Codex and others. A .mdc file is included for Cursor's native rules format.

Used in production

Explore all stacks
Where this stack fits

Stack It First recommends it at:

Walk the mobile roadmap