Mobile Developer interview preparation

Mobile Developer Interview Questions

20 frequently asked Mobile Developer interview questions. Mobile development is an in-demand field focused on building reliable iOS, Android, and cross-platform apps, solving product, performance, release, offline, and device-integration tasks. The questions cover different levels, and you can practice answering them aloud in our interview trainer.

Start a Mobile Developer AI InterviewNo credit card required. 1 free session available.
Technical interview practice in EnglishA mode where non-native speakers can practice passing technical interviews.

Beginner questions

1What is the difference between storing an authentication token in standard key-value storage like SharedPreferences or UserDefaults versus platform secure storage like Android Keystore or iOS Keychain?

SharedPreferences and UserDefaults are preference stores, not dedicated secret stores. Their files are protected by app sandboxing and applicable OS storage protection, but the preference APIs do not add secret-specific encryption or access policies. iOS Keychain stores secrets such as tokens with configurable accessibility, synchronization, and access-control policies. Android Keystore stores and operates on cryptographic keys rather than arbitrary token strings; an app can encrypt a token with a Keystore-managed key and store the ciphertext separately. Keystore keys may be software- or hardware-backed depending on the device, algorithm, and configuration; check the security level instead of assuming TEE/StrongBox. Hardware-backed keys can remain non-exportable, but decrypted tokens still enter app memory, and a compromised app/device may misuse authorized operations. Choose backup and authentication policies deliberately.

// --- ANDROID ---
// INSECURE (Plain SharedPreferences):
val prefs = context.getSharedPreferences("app_prefs", Context.MODE_PRIVATE)
prefs.edit().putString("auth_token", token).apply() // Plaintext XML on disk

// SECURE (EncryptedSharedPreferences backed by Android Keystore):
val masterKey = MasterKey.Builder(context)
    .setKeyScheme(MasterKey.KeyScheme.AES256_GCM)
    .build()
val securePrefs = EncryptedSharedPreferences.create(
    context,
    "secure_prefs",
    masterKey,
    EncryptedSharedPreferences.PrefKeyEncryptionScheme.AES256_SIV,
    EncryptedSharedPreferences.PrefValueEncryptionScheme.AES256_GCM
)
securePrefs.edit().putString("auth_token", token).apply()

// --- IOS (Swift) ---
// INSECURE:
UserDefaults.standard.set(token, forKey: "auth_token") // Plain plist on disk

// SECURE (Keychain Services API):
let query: [String: Any] = [
    kSecClass as String: kSecClassGenericPassword,
    kSecAttrAccount as String: "user_auth_token",
    kSecValueData as String: token.data(using: .utf8)!,
    kSecAttrAccessible as String: kSecAttrAccessibleWhenUnlocked
]
SecItemAdd(query as CFDictionary, nil)
Try answering this question with an AI coach

2What is the primary purpose of a mobile CI/CD pipeline, and what unique stages and constraints distinguish it from web or backend deployment pipelines?

The primary purpose of a mobile CI/CD pipeline is to automate the building, testing, signing, and distribution of mobile client applications to maintain consistent quality and repeatable releases. Continuous Integration (CI) validates code changes through automated builds, static analysis, and unit testing. Continuous Delivery/Deployment (CD) packages, signs, and distributes binary artifacts to testing tracks (like TestFlight or Firebase App Distribution) or app stores. Mobile CI/CD differs from web and backend pipelines in several key ways: 1. Artifact Type: Builds produce compiled client binaries (.ipa, .apk, .aab) rather than running directly on servers or inside container images. 2. Runner Hardware Constraints: iOS compilation requires macOS hardware and Xcode command-line tools, whereas backend pipelines typically run on lightweight Linux containers. 3. Release Latency and Approvals: Publishing to end-users involves third-party app store review cycles (Apple App Store / Google Play Store), meaning deployments cannot be rolled back instantly via a server redeploy. Fixes require a new signed binary submission or runtime feature flags.

name: Mobile CI/CD Workflow

on:
  pull_request:
    branches: [main]
  push:
    tags:
      - 'v*.*.*'

jobs:
  ci_validation:
    name: Lint & Unit Tests
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Run Linter
        run: ./gradlew lint
      - name: Run Unit Tests
        run: ./gradlew testDebugUnitTest

  cd_release_ios:
    name: Build & Distribute iOS
    needs: ci_validation
    if: startsWith(github.ref, 'refs/tags/v')
    runs-on: macos-14
    steps:
      - uses: actions/checkout@v4
      - name: Install Signing Certificates
        run: fastlane match appstore --readonly
      - name: Build & Upload to TestFlight
        run: fastlane ios beta
Try answering this question with an AI coach

3In a cross-platform mobile application, what is the purpose of separating presentation, domain, and data layers, and how does this structure facilitate code sharing across iOS and Android?

Separating an application into presentation, domain, and data layers establishes clear boundaries of responsibility: 1. **Presentation Layer:** Handles UI rendering, user input, and screen-level state (e.g., Views, Widgets, ViewModels, or Presenters). 2. **Domain Layer:** Encapsulates pure business logic, domain models/entities, and use cases. It remains independent of UI and platform frameworks. 3. **Data Layer:** Manages data retrieval and persistence from remote APIs, local databases, or device cache via repositories and data sources. In cross-platform mobile development, this structure facilitates code sharing because the domain and data layers are platform-agnostic. Core business rules, data transformations, and network handling can be shared 100% across iOS and Android, allowing teams to either share the entire stack (as in Flutter or React Native) or share business/data logic while keeping platform-specific native presentation layers (as in Kotlin Multiplatform).

[Presentation Layer] (UI, Screens, ViewModels)
         │
         ▼ calls
[Domain Layer]       (Use Cases, Business Rules, Entities)
         ▲
         │ implements interfaces
[Data Layer]         (Repositories, API Clients, Local Storage)
Try answering this question with an AI coach

4What are the core differences between imperative and declarative UI development paradigms in mobile engineering, and how do Flutter widgets and React Native components embody the declarative model?

In imperative UI development, developers write explicit, step-by-step instructions to create, mutate, and destroy UI elements (such as finding a view by ID and directly calling methods like setText or setVisibility). In contrast, declarative UI models describe what the UI should look like for a given state (often expressed as UI = f(state)). When state changes, the framework determines how to update the visual representation efficiently. Flutter and React Native both embody this declarative paradigm. In Flutter, widgets are immutable configuration descriptions; when dynamic data changes, calling setState() in a StatefulWidget schedules a rebuild where the build() method returns a new widget tree description that Flutter reconciles against its Element and RenderObject trees. In React Native, components are functions or classes returning JSX; updating state or props triggers a re-render where React reconciles the virtual element tree and applies the minimal necessary native updates across the bridge or native runtime.

class CounterWidget extends StatefulWidget {
  const CounterWidget({super.key});
  @override
  State<CounterWidget> createState() => _CounterWidgetState();
}

class _CounterWidgetState extends State<CounterWidget> {
  int _count = 0;

  void _increment() {
    setState(() {
      _count++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return ElevatedButton(
      onPressed: _increment,
      child: Text('Count: $_count'),
    );
  }
}
Try answering this question with an AI coach

5What is the operational difference between a cold start, a warm start, and a hot start in mobile applications, and why is cold start the most critical metric for performance budgets?

In mobile app lifecycles, startup states differ based on whether the app's process and memory state already exist in the OS. - Cold Start: The app starts from scratch because the OS has not created its process, or the process was previously killed. The OS must allocate a new process, load binaries/runtimes, initialize the Application/runtime context, and inflate the first view. It has the highest latency. - Warm Start: The app's process is usually already in memory, but the activity/view hierarchy was destroyed or evicted (e.g., due to background recreation or back navigation). The OS re-creates the UI/activity without needing to fork/spawn a new process from scratch. - Hot Start: The app and its UI state are still fully resident in memory (e.g., the user pressed Home and immediately returned). The OS merely brings the existing view hierarchy to the foreground with near-zero initialization overhead. Cold start is the most critical metric for performance budgets because it represents the slowest first-impression experience for users. Long cold starts directly correlate with immediate user drop-off, lower retention, and poor app store rankings (such as Android Vitals thresholds).

Cold Start: [OS Process Spawn] -> [App Runtime Init] -> [Activity/UI Creation] -> [First Frame Drawn]
Warm Start: [Existing Process]  -> [Activity/UI Recreation] -> [First Frame Drawn]
Hot Start:  [Existing Process]  -> [Bring Existing View to Foreground] (Instant)
Try answering this question with an AI coach

6What is a native bridge in a cross-platform mobile app, and when would you use one instead of writing the feature entirely in Flutter or React Native code?

A native bridge is the communication layer that lets cross-platform code call platform-specific iOS or Android code, and lets native code return results or send events back. In Flutter this is commonly done with platform channels or plugins. In React Native it is commonly done with native modules, TurboModules, or native UI components. You use a bridge when a feature needs something that pure Flutter or React Native code cannot access well enough, such as a platform API, device capability, native SDK, performance-sensitive native implementation, or native UI component. Common examples include camera features, Bluetooth, push notifications, payments, secure storage, background services, health APIs, or SDKs that only provide Swift/Objective-C or Kotlin/Java integrations. A good bridge usually exposes a small, clear API to the cross-platform layer, such as getBatteryLevel, startBluetoothScan, or openNativePaymentSheet, while the platform-specific implementation handles the real iOS and Android details.

Cross-platform screen:
  calls NativePayments.openPaymentSheet(orderId)

iOS implementation:
  uses Apple Pay / native payment SDK

Android implementation:
  uses Google Pay / native payment SDK
Try answering this question with an AI coach

7What does an offline-first architecture mean in mobile development, and how does it fundamentally differ from standard HTTP response caching?

In mobile development, an offline-first architecture treats local storage as the primary source of truth for both read and write operations. Instead of waiting for network requests to complete before rendering or allowing user interactions, the app interacts directly with the local database or storage layer, while background synchronization processes handle reconciling local changes with the remote server when connectivity is available. This fundamentally differs from standard HTTP response caching in several ways: 1. **Data Model**: HTTP caching stores raw network responses (e.g., JSON payloads) keyed by request URLs and headers. Offline-first architecture stores structured domain entities in a local database (like Room, SQLite, or SwiftData/Core Data). 2. **Writes vs. Reads**: HTTP caching is primarily a read-optimization mechanism and does not natively support offline write transactions or mutations. Offline-first allows full local writes, queuing mutations for later server synchronization. 3. **Queryability and Lifecycle**: Cached HTTP responses are subject to automatic cache eviction policies and cannot be arbitrarily queried, filtered, or joined. Offline-first persistence provides full querying, indexing, and deterministic lifecycle management independent of network status.

/* Network-First with HTTP Caching */
UI -> Network Request -> [Cache Hit ? Return Cached JSON : Fetch from API -> Save to HTTP Cache] -> UI
// Limitation: Read-only optimization; offline writes fail immediately.

/* Offline-First with Local Source of Truth */
UI <-> Observes Local DB (e.g., Room / Core Data / SQLite)
User Write -> Write to Local DB -> Queue Sync Task
Sync Worker (Background) -> Send queued mutations to Server -> Update Local DB with Server Response
Try answering this question with an AI coach

8What is the difference between a remote push notification and a local notification in a mobile app?

The core difference between local and remote push notifications lies in where they originate and how they are triggered: 1. Local Notifications are created, scheduled, and triggered entirely on the device by the application using OS APIs (such as UserNotifications on iOS or AlarmManager/WorkManager/NotificationManager on Android). They trigger based on device-side conditions such as a specific date/time, a countdown timer, or a geographic boundary (geofencing). Because they run locally on the operating system daemon, they do not require a backend server or an active internet connection at delivery time. 2. Remote Push Notifications originate from an external application server and are transmitted over the internet via platform push gateways (APNs for Apple devices, FCM for Android). The gateway delivers the payload to the device's OS-level daemon, waking the app or posting a banner. Remote notifications are required for real-time external events such as incoming chat messages, friend requests, or breaking news.

let content = UNMutableNotificationContent()
content.title = "Workout Reminder"
content.body = "Time for your daily exercise routine."
content.sound = .default

// Triggers locally after 1 hour (3600 seconds) without any server interaction
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 3600, repeats: false)
let request = UNNotificationRequest(identifier: "dailyWorkout", content: content, trigger: trigger)

UNUserNotificationCenter.current().add(request) { error in
    if let error = error {
        print("Failed to schedule notification: \(error)")
    }
}
Try answering this question with an AI coach

9What is the structural and operational difference between an Android App Bundle (.aab), an APK, and an iOS IPA archive when distributing apps through app stores?

An APK (Android Package) is an executable package format containing compiled DEX bytecode, resources, assets, and native libraries that can be directly installed and run on an Android device. A universal APK bundles resources for all screen densities, CPU architectures, and languages, leading to larger download sizes. An Android App Bundle (.aab) is an upload/publishing format required by Google Play for store distribution. An AAB cannot be installed directly on a device; instead, Google Play uses the bundle and Play App Signing to generate optimized split APKs tailored dynamically to a specific device's architecture, screen density, and language (Dynamic Delivery). An iOS IPA (.ipa) is an application archive file (a zip container enclosing the Payload directory, `.app` bundle, signing assets, and metadata). When uploaded to App Store Connect, Apple performs App Thinning (such as App Slicing) to deliver only the assets and binaries required for the downloading device. Operationally, APKs and IPAs can be directly installed onto physical test devices (subject to signing and provisioning), whereas an AAB must first be converted into split APKs (e.g., using `bundletool`) prior to local device installation.

# 1. Standalone APK installs directly via ADB
adb install myapp-universal.apk

# 2. AAB requires bundletool to generate device-tailored split APKs
bundletool build-apks --bundle=myapp.aab --output=myapp.apks --connected-device

# 3. Install the generated split APK set onto the connected device
bundletool install-apks --apks=myapp.apks
Try answering this question with an AI coach

10What protection does Transport Layer Security (TLS) provide for a mobile application's network calls, and how do modern mobile operating systems enforce secure transport defaults?

Transport Layer Security (TLS) protects mobile network calls by providing three essential guarantees: confidentiality (encrypting data in transit so eavesdroppers cannot read payloads or headers), data integrity (detecting any tampering or modification of requests and responses in transit), and server authentication (validating the server's digital certificate against trusted Certificate Authorities to prevent Man-in-the-Middle attacks). Modern mobile operating systems enforce secure transport by default by blocking unencrypted cleartext HTTP traffic: 1. iOS enforces App Transport Security (ATS), requiring network connections (such as those via URLSession) to use HTTPS with TLS 1.2+ unless domain exceptions are explicitly defined in Info.plist. 2. Android (API 28+) disables cleartext HTTP traffic by default (`cleartextTrafficPermitted=false`). Allowing unencrypted HTTP requires explicit exceptions via Network Security Configuration (`network_security_config.xml`) or the manifest attribute `android:usesCleartextTraffic`.

<!-- Android: res/xml/network_security_config.xml -->
<network-security-config>
    <!-- Cleartext HTTP blocked by default. Exceptions require explicit declaration -->
    <domain-config cleartextTrafficPermitted="false">
        <domain includeSubdomains="true">api.example.com</domain>
    </domain-config>
</network-security-config>

<!-- iOS: Info.plist ATS configuration -->
<!-- ATS blocks HTTP by default; exceptions must be declared inside NSAppTransportSecurity -->
<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
    <false/>
</dict>
Try answering this question with an AI coach

Intermediate questions

11What roles do RTSP, RTMP and HLS play in a video delivery pipeline?

RTSP is a session-control protocol with operations such as setup, play and pause; media commonly travels using RTP rather than being the control messages themselves. RTMP carries multiplexed media and control over a persistent connection and is commonly used from a broadcaster to an ingest server. HLS describes HTTP playlists and media segments or parts, allowing CDN delivery and adaptive bitrate selection. A pipeline might ingest RTMP, transcode into several renditions, package HLS, and distribute it over HTTP. A camera-oriented system might instead receive an RTSP/RTP source before packaging. These are roles, not exclusive capabilities or codec definitions. End-to-end latency depends on encoding, segment/part duration, buffering and network behavior; the protocol name alone does not determine the delay.

Try answering this question with an AI coach

12How would a DLNA control point detect and recover when a previously available playback device goes offline?

A DLNA control point should not depend solely on an orderly goodbye. I would process SSDP byebye notifications, expire discovery entries when their advertised lifetime ends, and treat repeated transport failures or subscription-renewal failures as additional evidence of unavailability. A missed packet alone should not immediately destroy the user's selection. The UI can mark the renderer unavailable, stop issuing unbounded commands, and retry discovery with bounded backoff while respecting network changes. On rediscovery I match the persistent device identifier rather than the old IP address, reload service endpoints, and re-establish event subscriptions. I then query transport state before offering to resume, since the device may have restarted or another controller may have changed playback. Failed commands are retried only when doing so is safe.

Try answering this question with an AI coach

13Once the first video frame appears, how can a player reduce repeated stalls on a slow or fluctuating connection?

I would track playable buffer duration and recent segment throughput, then choose a rendition comfortably below sustainable bandwidth rather than the peak observed rate. When the buffer is shrinking, downgrade promptly; upgrade cautiously with hysteresis so the player does not oscillate. After a stall, rebuild a useful buffer before resuming instead of repeatedly playing a few frames and stopping. For on-demand content, more forward buffering may be acceptable; live playback must balance that buffer against distance from the live edge. Segment request scheduling, connection reuse and avoiding unnecessary competing downloads also help. I would separate download time from decode time and dropped frames: reducing network bitrate alone may not fix a decoder overload. Success is fewer stall seconds at an acceptable quality and startup/live-latency cost.

Try answering this question with an AI coach

14How do Weex and React Native compare as approaches for building a native mobile interface from JavaScript?

Both Weex and React Native let JavaScript describe interfaces that are represented by native mobile components rather than simply displaying a web page in a WebView. Weex separates its rendering engine from the frontend syntax layer and has supported frameworks such as Vue and Rax. React Native uses React's component model; its modern architecture includes Fabric and native integration mechanisms that differ from its older asynchronous bridge. Neither makes browser CSS or platform behavior universally identical across iOS and Android. I would compare the exact versions, supported native modules, layout behavior, debugging, accessibility and upgrade path against the application's needs. Shared business logic can reduce duplication, but platform-specific components and native integration remain necessary. A small representative prototype is more informative than assuming that JavaScript alone ensures equal performance.

Try answering this question with an AI coach

15How would you define and measure iOS app launch time so results from different releases are comparable?

I define a primary system launch metric from launch initiation to the first application frame, using the tool's documented endpoint, and a separate time-to-interactive or useful-content milestone. The launch screen is not proof that the app is ready. I separate process launches from resumes and classify cold versus warm conditions, because cached binaries and prewarming change results. Comparisons use release builds on matched devices and OS versions, with consistent data, network, installation state and thermal conditions; a debugger can distort timing. I collect repeated runs and report median and tail percentiles, not one stopwatch value. Instruments and XCTest help reproduce regressions, while MetricKit or Organizer provides field distributions. Signposts around initialization, data loading and scene construction identify which stage changed.

Try answering this question with an AI coach

16How do thread boundaries operate across native bridge calls, and how do you prevent thread-hopping stalls or UI jank when native modules perform heavy background work?

Cross-platform frameworks use specific threading conventions for bridge calls: for instance, standard Flutter `MethodChannel` calls arrive on the platform's main UI thread, while traditional React Native bridge calls run on a dedicated JavaScript thread and dispatch asynchronously to native threads. When a native bridge method executes on the native UI/main thread, running CPU-heavy operations, long synchronous disk I/O, or blocking network tasks blocks the main run loop. This leads to dropped frames, visible UI jank, and on Android, Application Not Responding (ANR) errors or iOS watchdog termination. To prevent this, native bridge handlers should offload heavy or blocking work to background execution pools (e.g., Kotlin Coroutines with `Dispatchers.IO`/`Dispatchers.Default`, Android `ThreadPoolExecutor`, or Swift `Task.detached` / GCD `DispatchQueue.global()`). Once the work finishes, the result must be dispatched back to the bridge thread expected by the framework (e.g., returning results on the UI thread for standard MethodChannels or using background task queues), ensuring cross-platform state updates do not block the UI rendering cycle.

class ImageProcessorPlugin : MethodChannel.MethodCallHandler {
    private val scope = CoroutineScope(Dispatchers.Default + SupervisorJob())

    override fun onMethodCall(call: MethodCall, result: MethodChannel.Result) {
        if (call.method == "applyFilter") {
            val imageBytes = call.argument<ByteArray>("image") ?: return result.error("INVALID_ARG", "Image null", null)
            
            // Dispatch heavy computation off the main UI thread
            scope.launch {
                try {
                    val processed = processBitmapBytes(imageBytes) // CPU heavy work
                    withContext(Dispatchers.Main) {
                        result.success(processed)
                    }
                } catch (e: Exception) {
                    withContext(Dispatchers.Main) {
                        result.error("PROCESSING_FAILED", e.localizedMessage, null)
                    }
                }
            }
        } else {
            result.notImplemented()
        }
    }
}
Try answering this question with an AI coach

17How would you design a caching and invalidation strategy for list and feed screens using Stale-While-Revalidate and conditional HTTP headers?

A resilient caching and invalidation strategy for feed and list screens combines the Stale-While-Revalidate (SWR) pattern with conditional HTTP validation headers (such as `ETag` / `If-None-Match` or `Last-Modified` / `If-Modified-Since`). When the screen opens, it immediately reads and renders cached data from a local database (the Single Source of Truth, e.g., Room or Core Data/SQLite), giving the user an instant UI render. Simultaneously, a background network request is dispatched with the cached `If-None-Match: <etag>` header. If the server responds with `304 Not Modified`, no payload is transferred, validating the local cache while saving bandwidth and battery. If the server responds with `200 OK`, the new data and updated `ETag` are written to the local database in a transaction, and reactive database observers automatically emit the updated list to the UI. For pagination, page tokens or offsets are stored alongside cached records. Invalidation is triggered by TTL expiration, user actions (such as pull-to-refresh bypassing conditional headers), or local mutation side-effects (e.g., creating or deleting an item locally updates the database optimistically and flags cached page cursors for revalidation).

fun getFeed(): Flow<List<FeedItem>> = flow {
    val cached = feedDao.getFeedItems()
    if (cached.isNotEmpty()) emit(cached)
    
    val lastEtag = feedDao.getFeedEtag()
    try {
        val response = api.fetchFeed(ifNoneMatch = lastEtag)
        if (response.code() == 200 && response.body() != null) {
            feedDao.updateFeedTransaction(response.body()!!, response.headers()["ETag"])
            emit(feedDao.getFeedItems())
        }
    } catch (e: Exception) {
        if (cached.isEmpty()) throw e
    }
}
Try answering this question with an AI coach

Advanced questions

18A financial mobile application must store refresh tokens securely on device, support biometric unlocking, survive OS upgrades, and operate securely during temporary offline sessions. How would you design this token storage and access architecture?

Store refresh tokens in iOS Keychain with explicit accessibility and biometric access-control policies, or encrypt them with an Android Keystore-managed key configured for biometric authorization. AfterFirstUnlockThisDeviceOnly controls accessibility/migration and is not itself a biometric requirement. Verify hardware support rather than assuming StrongBox or universal Secure Enclave storage. Keep access tokens short-lived and preferably in memory; serialize refresh and atomically persist rotated tokens. Test OS upgrades, enrollment changes, lockout, reinstall, backup/restore, and key invalidation, with a reauthentication recovery path instead of guaranteed survival. Offline access should expose only limited encrypted local data under a documented policy, with bounded duration and queued actions reauthorized on reconnect. A disconnected client cannot learn current server revocation, and local clock checks alone are not a strong anti-tamper guarantee. Defer token refresh and high-value server transactions until online; revoke affected server sessions and clear associated local credentials/data on confirmed invalidation.

val keyStore = KeyStore.getInstance("AndroidKeyStore").apply { load(null) }
val keyGenerator = KeyGenerator.getInstance(KeyProperties.KEY_ALGORITHM_AES, "AndroidKeyStore")
val spec = KeyGenParameterSpec.Builder(
    "refreshTokenKeyAlias",
    KeyProperties.PURPOSE_ENCRYPT or KeyProperties.PURPOSE_DECRYPT
)
    .setBlockModes(KeyProperties.BLOCK_MODE_GCM)
    .setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_NONE)
    .setUserAuthenticationRequired(true)
    .setUserAuthenticationParameters(0, KeyProperties.AUTH_BIOMETRIC_STRONG)
    .setInvalidatedByBiometricEnrollment(true)
    .build()
keyGenerator.init(spec)
keyGenerator.generateKey()
Try answering this question with an AI coach

19How would you design a scalable CI/CD infrastructure for a cross-platform mobile monorepo supporting multiple teams while managing limited and costly macOS runner capacity?

To design a scalable CI/CD infrastructure for a cross-platform mobile monorepo while optimizing scarce and expensive macOS capacity, the architecture must rely on graph-aware affected build detection, strict workload bifurcation across hybrid runner fleets, and virtualization/ephemeral orchestration for macOS. First, implement a monorepo build graph tool (such as Bazel, Nx, or Turborepo) with distributed remote caching. On every pull request, the CI pipeline calculates the directed acyclic graph (DAG) diff against the target branch to build and test only affected packages and their downstream dependents, bypassing unchanged modules entirely. Second, implement a hybrid runner allocation strategy: offload all tasks that do not strictly require Xcode (such as TypeScript/Dart linting and compilation, unit tests, static code analysis, security scanning, and Android Gradle builds) to cost-effective, scalable Linux/Kubernetes runners. Reserve macOS runners strictly for final iOS assembly, Swift/Objective-C compilation, code signing, and iOS Simulator test execution. Third, manage macOS runners using virtualization infrastructure (such as Tart, Anka, or AWS/MacStadium bare-metal nodes orchestrated via Nomad or Kubernetes). Each iOS build runs in a clean, ephemeral virtual machine with pre-warmed toolchains and derived-data caches, preventing runner drift and enabling rapid autoscaling based on pipeline queue depth.

name: Cross-Platform Monorepo CI
on: [pull_request]
jobs:
  detect-changes:
    runs-on: ubuntu-latest
    outputs:
      ios_affected: ${{ steps.filter.outputs.ios }}
      android_affected: ${{ steps.filter.outputs.android }}
    steps:
      - uses: actions/checkout@v4
      - id: filter
        run: |
          # Determine affected targets via monorepo tool (e.g. nx / bazel)
          echo "ios=$(./tools/affected.sh ios)" >> $GITHUB_OUTPUT
          echo "android=$(./tools/affected.sh android)" >> $GITHUB_OUTPUT

  build-android:
    needs: detect-changes
    if: needs.detect-changes.outputs.android_affected == 'true'
    runs-on: ubuntu-latest-16core
    steps:
      - uses: actions/checkout@v4
      - run: ./gradlew assembleRelease

  build-ios:
    needs: detect-changes
    if: needs.detect-changes.outputs.ios_affected == 'true'
    runs-on: macos-14
    steps:
      - uses: actions/checkout@v4
      - run: bundle exec fastlane ios build_and_test
Try answering this question with an AI coach

20How would you design a cross-platform mobile architecture for a product expected to share most business logic across iOS and Android while still allowing platform-specific UI, navigation, and native integrations to evolve independently?

I would design the app around a shared core that owns stable business behavior: domain models, validation, use cases, business rules, and data-access contracts. Platform-specific UI, navigation, native SDKs, permissions, lifecycle handling, and app-shell concerns should stay outside that core. The shared code should not import UIKit, SwiftUI, Jetpack, Android framework APIs, React Native navigation, Flutter navigation, or native SDK details. Instead, it should depend on narrow interfaces such as AuthRepository, SecureStorage, Analytics, CameraService, or PaymentProvider that each platform implements. I would organize code by feature as much as possible rather than creating one large shared layer. For example, checkout, search, account, and messaging can each have shared domain/use-case code, state contracts, and repository interfaces. The iOS and Android shells then own screen composition, native UI patterns, navigation stacks, permissions, and adapter wiring. Presentation logic can be shared when it is truly UI-framework-agnostic, such as reducers, state machines, or view-model contracts that emit simple state and actions, but actual views and navigation should remain platform-owned so each platform can evolve independently. The main trade-off is to share common, stable business logic aggressively while avoiding abstractions that hide real platform differences. I would enforce boundaries with module dependency rules, dependency injection, public APIs, contract tests, architecture checks, and clear ownership. Native integrations should use ports/adapters so the shared feature code sees a common capability while each platform handles SDK behavior, lifecycle, permissions, errors, and UX differences in its own layer.

shared-core/
  checkout/
    domain/          # Money, Cart, CheckoutRules, PlaceOrderUseCase
    ports/           # PaymentGateway, TaxRepository, Analytics
    state/           # CheckoutStateMachine or ViewModel contract

ios-app/
  checkout-ui/       # SwiftUI/UIKit screens and iOS navigation
  adapters/          # ApplePayPaymentGateway, KeychainStorage

android-app/
  checkout-ui/       # Compose/XML screens and Android navigation
  adapters/          # GooglePayPaymentGateway, EncryptedSharedPrefsStorage
Try answering this question with an AI coach

Practice Mobile Developer interviews on your phone

Answer out loud and get AI feedback in the Android app.

Get EngineerSpeak on Google Play
Scan to download