--- name: ck-mobile-development description: Build mobile apps with React Native, Flutter, Swift/SwiftUI, Kotlin/Jetpack Compose. Use for iOS/Android development, mobile UX patterns, offline-first architecture, and app store deployment. --- # Mobile Development Production-ready mobile development across React Native, Flutter, Swift, and Kotlin. ## When to Use - Building iOS, Android, or cross-platform mobile apps - Implementing mobile-first UX (offline-first, push notifications, deep linking) - Making native vs cross-platform framework decisions - Optimizing battery, memory, network for mobile constraints - Deploying to App Store or Google Play ## Don't Use When - Building responsive web apps (use web frameworks instead) - Desktop applications (use Electron or native desktop frameworks) - Simple PWAs that don't require native capabilities ## Framework Selection | Need | Choose | |------|--------| | JavaScript team, web code sharing | React Native | | Performance-critical, complex animations | Flutter | | Maximum iOS performance, latest features | Swift/SwiftUI | | Maximum Android performance, Material 3 | Kotlin/Compose | | Rapid prototyping | React Native + Expo | | Gaming / heavy graphics | Native or Unity | ## Performance Targets - Launch: <2s (70% abandon if >3s) - Memory: <100MB typical screens - Frame rate: 60 FPS (16.67ms/frame) - App size: <50MB initial download - Battery: <5% drain/hour active use ## Architecture Patterns - **Small-medium apps:** MVVM - **Enterprise:** MVVM + Clean Architecture - **State:** Zustand (React Native), Riverpod 3 (Flutter), StateFlow (Android) - **Sync:** Offline-first with hybrid push/pull ## Security (OWASP Mobile Top 10) - OAuth 2.0 + JWT + Biometrics for auth - Keychain (iOS) / KeyStore (Android) for secrets - Certificate pinning for network security - Never hardcode credentials or API keys ## Testing Strategy - Unit tests: 70%+ coverage for business logic - E2E: Detox (React Native), XCUITest (iOS), Espresso (Android) - Real device testing mandatory before release ## Platform Guidelines **iOS (HIG):** Tab bar, navigation bar, San Francisco font, safe areas, haptic feedback **Android (Material 3):** Bottom nav, FABs, Roboto font, Material You dynamic colors, ripple effects ## Deployment - Fastlane for automation - Staged rollouts: Internal → Closed → Open → Production - CI/CD saves ~20% development time ## Common Pitfalls 1. Testing only on simulators (real devices show true performance) 2. Ignoring platform conventions 3. No offline handling 4. Hardcoded credentials 5. Skipping accessibility (excludes 15%+ of users) ## Resources - React Native: https://reactnative.dev/ - Flutter: https://flutter.dev/ - iOS HIG: https://developer.apple.com/design/human-interface-guidelines/ - Material Design 3: https://m3.material.io/ - OWASP Mobile: https://owasp.org/www-project-mobile-top-10/