https://kotlinlang.org logo
Join Slack
Powered by
# compose-ios
  • c

    Christopher Mederos

    08/05/2025, 5:29 AM
    I'm running into an issue on iOS with Koin & compose-navigation where
    collectAsStateWithLifecycle
    stops getting new values after restoring a view model after navigation. However, collecting without lifecycle does keep updating
    Copy code
    @Composable
    fun MyScreen(viewModel: MyViewModel = koinViewModel()) {
        val scope = rememberCoroutineScope()
        // collectLatest: Does Update
        scope.launch {
            viewModel.uiState.collectLatest { state -> println("collectLatest Id: ${state.id}") }
        }
    
        // collectAsState: Does Update
        val uiState by viewModel.uiState.collectAsState()
        Text("collectAsState Id: ${uiState.id}: ")
    
        // collectAsStateWithLifecycle: Does NOT Update
        val uiStateWithLifecycle by viewModel.uiState.collectAsStateWithLifecycle()
        Text("collectAsStateWithLifecycle Id: ${uiStateWithLifecycle.id}: ")
    }
    Any ideas on where I should go looking for a fix?
    • 1
    • 1
  • j

    Javier RG

    08/06/2025, 2:17 PM
    Hi everyone, have any of you experienced a high delay when throwing an exception using compose multiplatform on iOS target?
    g
    t
    • 3
    • 8
  • t

    tylerwilson

    08/15/2025, 1:43 AM
    Trying to update to Compose 1.9.0 and CMP 1.9.0-beta03, and having an issue building for iOS. It appears to me that the lifecycle-viewmodel-savedstate has not been built for iOS. See here: https://central.sonatype.com/search?q=lifecycle-viewmodel-savedstate most packages have the version of 2.9.2 , but the ios bits are 2.9.0-alpha6. And it will not build on iOS. Building with Kotlin 2.2.10. Thank you.
    same 1
    plus1 1
    z
    m
    s
    • 4
    • 7
  • i

    Ismail

    08/15/2025, 6:00 PM
    Hey, so i'm using the swift tabview within my cmp app, at the moment its not showing because i need to give it a fixed height, but how do i use the default tabview height and padding?
    Copy code
    @Composable
    actual fun PlatformBottomNavigation(
        selectedTabIndex: Int,
        onTabSelected: (Int) -> Unit,
        navigateToSettings: () -> Unit
    ) {
        val factory = LocalNativeViewFactory.current
        UIKitViewController(
            factory = {
                factory.createBottomNavigation(
                    selectedTabIndex = selectedTabIndex,
                    onTabSelected = onTabSelected,
                    navigateToSettings = navigateToSettings
                )
            },
            modifier = Modifier
                .fillMaxWidth()
        )
    }
    ✅ 1
    • 1
    • 1
  • f

    faogustavo

    08/18/2025, 1:55 PM
    🧵 Autofill support on iOS
    ⬆️ 2
    a
    • 2
    • 5
  • f

    Farhazul Mullick

    08/18/2025, 5:24 PM
    Did anyone faced this error? Tried all this verions. But facing same IrLinkageError.
    Copy code
    # kotlin = "2.1.20" compose = "1.8.2", jbNavigation = "2.8.0-alpha08"
    # kotlin = "2.1.10" compose = "1.8.2" jbNavigation = "2.8.0-alpha08"
    # kotlin = "2.1.10" compose = "1.8.2" jbNavigation = "2.8.0-alpha10"
    Copy code
    Uncaught Kotlin exception: kotlin.native.internal.IrLinkageError: Can not read value from backing field of property 'androidx_compose_animation_core_SeekableTransitionState$stable': Private backing field of property declared in module <org.jetbrains.compose.animation:animation-core> can not be accessed in module <org.jetbrains.androidx.navigation:navigation-compose>
    a
    • 2
    • 4
  • t

    Tristan

    08/19/2025, 11:28 PM
    Hello, using KMP Compose 1.8.2 I am having an issue with text fields. When I tap on a text field I get this error
    Copy code
    Can't show file for stack frame : <DBGLLDBStackFrame: 0x149e1ea90> - stackNumber:0 - name:kfun:kotlin.coroutines.Continuation#<get-context>(){}kotlin.coroutines.CoroutineContext-trampoline. The file path does not exist on the file system: /opt/buildAgent/work/2d153abd4d2c0600/kotlin/libraries/stdlib/src/kotlin/coroutines/Continuation.kt
    And the text field I am using
    Copy code
    var textFieldValue by remember {
        mutableStateOf("")
    }
                    
    OutlinedTextField(
        value = textFieldValue,
        onValueChange = { textFieldValue = it },
        singleLine = true,
        modifier = Modifier.width(160.dp)
    )
    And my imports
    Copy code
    implementation(compose.runtime)
                implementation(compose.foundation)
                implementation(compose.material3)
                implementation(compose.ui)
                implementation(compose.components.resources)
                implementation(compose.components.uiToolingPreview)
    Do you think I am missing something? Other UI elements work fine (buttons and checkboxes)
    a
    d
    • 3
    • 8
  • d

    DevOpsCraftsman

    08/21/2025, 12:55 AM
    Hello everyone. In my team, we are having a big problem with
    TextField
    (and related) on iOS, it always crashes when we trying to click in it... The sample code:
    Copy code
    @Composable
    @Preview
    fun App() {
        TextField(value = "Type", onValueChange = {})
    }
    The srceenshot of the app in the simulator and the crash We tested with compose 1.8.2, 1.8.1, and 1.8.0. For iOS: 18 and 17. EDIT: we are using the 2.9.1 version of the life cycle view mode compose lib, so the proposed fix proposed in thread of the post above doesn't work... The crash error message:
    Copy code
    Can't show file for stack frame : <DBGLLDBStackFrame: 0x12c607040> - stackNumber:0 - name:kfun:kotlin.coroutines.Continuation#<get-context>(){}kotlin.coroutines.CoroutineContext-trampoline. The file path does not exist on the file system: /opt/buildAgent/work/2d153abd4d2c0600/kotlin/libraries/stdlib/src/kotlin/coroutines/Continuation.ktCan't show file for stack frame : <DBGLLDBStackFrame: 0x11c60ab40> - stackNumber:1 - name:kfun:kotlin.coroutines.native.internal.ContinuationImpl#<init>(kotlin.coroutines.Continuation<kotlin.Any?>?){}. The file path does not exist on the file system: /opt/buildAgent/work/2d153abd4d2c0600/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/coroutines/ContinuationImpl.ktCan't show file for stack frame : <DBGLLDBStackFrame: 0x11c60ab40> - stackNumber:1 - name:kfun:kotlin.coroutines.native.internal.ContinuationImpl#<init>(kotlin.coroutines.Continuation<kotlin.Any?>?){}. The file path does not exist on the file system: /opt/buildAgent/work/2d153abd4d2c0600/kotlin/kotlin-native/runtime/src/main/kotlin/kotlin/coroutines/ContinuationImpl.kt
    c
    s
    +3
    • 6
    • 8
  • c

    Calle Höglund

    08/21/2025, 9:34 AM
    Hello everybody! Currently testing around in a CMP project. Im having trouble updating the state inside a swiftUI view.
    Copy code
    @Composable
    actual fun NativeButton(
        enabled: Boolean,
        onClick: () -> Unit,
        modifier: Modifier
    ) {
        val factory: NativeViewFactory = LocalNativeViewFactory.current
    
        UIKitViewController(
            modifier = modifier,
            factory = {
                factory.createNativeButton(
                    enabled = enabled,
                    onClick = onClick,
                )
            }
        )
    }
    Changing the enabled flag is not updating the UI in SwiftUI. How do i achieve this? Any suggestions? Thanks! 🙏
    r
    • 2
    • 4
  • a

    Alexis

    08/24/2025, 5:09 PM
    Hello, anyone tried to implement Google AdMob native app in ios using Compose Multiplatform? I've figured out how to load an ad's data, but it seem that I need a native view to handle user's click and that I can't simply use a Compose button's onClick callback. I suppose that I should go for a SwiftUI implementation, but before doing so I wanted to know if anyone had success implementing it in Compose 🙂 Thanks for reading and I wish you all a nice day!
    u
    • 2
    • 2
  • s

    Sam

    08/26/2025, 1:33 PM
    Has anyone got previews working on a project with an iOS target in
    commonMain
    ? I keep getting this:
    Copy code
    No matching variant of org.jetbrains.compose.ui:ui-tooling-preview:1.9.0-beta03 was found. The consumer was configured to find a library for use during 'kotlin-metadata', preferably optimized for non-jvm, as well as attribute 'org.jetbrains.kotlin.native.target' with value 'ios_x64',
    a
    i
    • 3
    • 4
  • a

    Alexis

    08/27/2025, 2:44 PM
    Hello everyone! I'm starting a new KMP, and I was wandering if for modular architecture, the use of an "umbrella" KMP module was still the recommended way to expose the share code to ios, or if things had change and we can now export our KMP modules as independant XCFramework?
    ✅ 1
    p
    j
    • 3
    • 7
  • m

    markturnip

    08/28/2025, 8:34 AM
    Compose navigation is really what lets iOS down when building a CMP app. I’m wondering whether I build out my navigation/coordinator flow natively by simply embedding each
    ComposeUIViewController
    in the
    UINavigationController
    However it seems @Kashismails has put together a working demo using Voyager. I wonder if anyone else is using a setup like this and in production? https://www.droidcon.com/2024/09/06/using-native-ios-navigation-from-compose-multiplatform/
    j
    c
    • 3
    • 13
  • a

    aidanvii

    08/28/2025, 1:48 PM
    After upgrading from Meerkat to Narwhal, we've noticed a change in how iOS run configurations are done. We are working in a monorepo with 3 apps, 2 of which are compose multiplatform. Even after setting the working directory to the app we actually want to run, it will always run the other. Obfuscated the names in the screenshot, but for example it would run app-1 instead (the working directory doesn't seem to have any effect here):
    c
    • 2
    • 8
  • g

    Guilherme Delgado

    08/29/2025, 7:48 PM
    Hi everyone, Has anyone recently run into a
    Uncaught Kotlin exception: org.jetbrains.compose.resources.MissingResourceException: Missing resource with path:
    (runtime exception) when running a CMP project through Xcode? The strange thing is that the same project runs fine when launched from Android Studio. This happens when using Swift Export.
  • d

    Dumitru Preguza

    09/04/2025, 12:04 AM
    When I run the compose app on my physical iPhone from IDEA -> the app builds -> link -> and does not run; no error message or anything else, just does not run and the Run icon becomes available again. Works when I run the same project from XCode
  • m

    Mario

    09/10/2025, 3:21 PM
    Anyone else also seeing this error on Sentry? It doesn't look like a false alarm, and we've had issues report that the app freezes. Impact is around 3% of our userbase. We don't have ANR on Android.
    Copy code
    WatchdogTermination
    Level: Fatal
    The OS watchdog terminated your app, possibly because it overused RAM.
    I haven't been able to pinpoint it to a single reason. It may happen shortly after launch, or after an hour of usage. There are three screens where it most commonly happens (58%, 27%, 18% or 3% others). Happens for many iOS versions & models (even top-end like iPhone 16 Pro). It completely crashes our app, so it's pretty important. Where should I look next? Thank you 🙏
    h
    • 2
    • 3
  • a

    andrewreitz

    09/14/2025, 8:41 PM
    Would anyone know if there's more to getting Compose to run on iOS simulator than just this? https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-multiplatform-create-first-app.html#run-your-application-on-ios I setup a new project in Android Studio with compose multiplatform, and the only thing I change from the provided code is adding
    compose.ios.resources.sync=false
    to the gradle.properties reason. When I click the run button I just get the message "Build failed in 1 sec" on the messages tab, and if I check the build tab it shows everything was successful. No other output. Any help would be greatly appreciated.
    c
    • 2
    • 7
  • e

    Ezekiel Adetoro

    09/15/2025, 9:11 AM
    Hello all, I have this error while trying out compose multiplatform.
    error: Cannot query the value of this provider because it has no value available. * What went wrong:
    Execution failed for task ':composeApp:syncComposeResourcesForIos'.
    > Cannot query the value of this provider because it has no value available.
    And in XCode, I have this error:
    /KMP/iosApp/iosApp/ContentView.swift:3:8 No such module 'ComposeApp'
    . I have tried to apply many solution i foound online which does not work. I tried to use
    ./gradlew composeApp:syncComposeResourcesForIos
    I got:
    > Task :composeApp:syncComposeResourcesForIos FAILED. * What went wrong:
    Execution failed for task ':composeApp:syncComposeResourcesForIos'.
    > Error while evaluating property 'xcodeTargetArchs' of task ':composeApp:syncComposeResourcesForIos'.
    > Could not infer iOS target architectures. Make sure to build via XCode (directly or via Kotlin Multiplatform Mobile plugin for Android Studio)
    . What am I doing wrong? How can I solve this issue?
    j
    c
    +2
    • 5
    • 11
  • f

    ferdialif02

    09/17/2025, 5:18 AM
    When i tried to use Material3 Calendar in compose iOS, it caught on error saying : Uncaught Kotlin exception: kotlin.native.internal.IrLinkageError: Can not get instance of singleton 'System': No class found for symbol 'kotlinx.datetime/Clock.System|null[0]' -depedency : kotlinx datetime : 0.7.1 Material3 : 19.0-beta05
    c
    • 2
    • 2
  • m

    Marek Niedbach

    09/17/2025, 3:05 PM
    Hello, do you know if there was any change related to the a11y on the iOS in latest release of compose (1.9.0)? My whole test suite stops working, and it looks like the issue fixed in 1.7.0 comes back - but there was no info about a11y changes in latest release notes. https://youtrack.jetbrains.com/issue/CMP-7024/Accessibility-for-compound-layouts-is-not-working-on-iOS-correctly My composable like:
    Copy code
    Card(modifier = Modifier.testTag("card").clickable {}) {
        Text("Foo", modifier = Modifier.testTag("title"))
        Text("Bar", modifier = Modifier.testTag("subtitle"))
    }
    stops working, whats more - the “Foo” nor “Bar” is not exposed as “label” on the iOS. I tried juggling with
    mergeDescendants
    but nothing helps. Any idea how to have both the clickable container and the accessibility access to the inner components?
    i
    • 2
    • 1
  • s

    Shariff

    09/17/2025, 8:37 PM
    has anyone experienced an inability to input a phone number on iOS simulators? My app was just rejected by Apple 2x because they were not able to enter the phone number to log on to the app. Im puzzled as I cannot repro this on any simulator or device. Here is my phone number form:
    Copy code
    @Composable
    fun PhoneNumberTextField(
        phoneNumber: String,
        onValueChange: (String) -> Unit,
        modifier: Modifier = Modifier,
        isError: Boolean = false
    ) {
        val numericRegex = Regex("[^0-9]")
        RadiusOutlinedTextField(
            modifier = modifier,
            value = phoneNumber,
            onValueChange = {
                val stripped = numericRegex.replace(it, "")
                // Allow editing by limiting to 10 digits only during input
                onValueChange(if (stripped.length > 10) {
                    stripped.substring(0, 10)
                } else {
                    stripped
                })
            },
            placeholder = "Phone Number",
            singleLine = true,
            visualTransformation = NanpVisualTransformation(),
            keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Phone),
            isError = isError
        )
    }
    
    class NanpVisualTransformation : VisualTransformation {
    
        override fun filter(text: AnnotatedString): TransformedText {
            val trimmed = if (text.text.length >= 10) text.text.substring(0..9) else text.text
    
            var out = if (trimmed.isNotEmpty()) "(" else ""
    
            for (i in trimmed.indices) {
                if (i == 3) out += ") "
                if (i == 6) out += "-"
                out += trimmed[i]
            }
            return TransformedText(AnnotatedString(out), phoneNumberOffsetTranslator)
        }
    
        private val phoneNumberOffsetTranslator = object : OffsetMapping {
    
            override fun originalToTransformed(offset: Int): Int =
                when (offset) {
                    0 -> offset
                    // Add 1 for opening parenthesis.
                    in 1..3 -> offset + 1
                    // Add 3 for both parentheses and a space.
                    in 4..6 -> offset + 3
                    // Add 4 for both parentheses, space, and hyphen.
                    else -> offset + 4
                }
    
            override fun transformedToOriginal(offset: Int): Int =
                when (offset) {
                    0 -> offset
                    // Subtract 1 for opening parenthesis.
                    in 1..5 -> offset - 1
                    // Subtract 3 for both parentheses and a space.
                    in 6..10 -> offset - 3
                    // Subtract 4 for both parentheses, space, and hyphen.
                    else -> offset - 4
                }
        }
    }
    m
    • 2
    • 1
  • e

    Ezekiel Adetoro

    09/22/2025, 6:03 PM
    Need help with this error please.
  • j

    James Robinson

    09/24/2025, 10:59 AM
    Has anyone tried using Compose on iOS for smaller subviews, like an image component? I’m curious if people have run into any issues, particularly freezing when a decent number of these components are visible on the same screen.
    a
    • 2
    • 4
  • w

    wisha khn

    09/24/2025, 5:28 PM
    Hey everyone, Has anyone here integrated a Microsoft Azure CI/CD pipeline with a KMP project? We’re running into an issue where, during the build, the pipeline is profiling not only the iosApp target but also the SPM packages. We’re using manual profiling instead of automatic, and this is causing problems. If anyone has faced this and found a solution, your help would be greatly appreciated! 🙏
    c
    • 2
    • 5
  • i

    iQQator

    10/01/2025, 9:16 AM
    Hello all, My questions is about embedding Compose view (not screen) into UIKit/SwiftUI contains project: • How to determine size of view manually (calculate before embed for example)? • We have only UIViewController representation, why not UIView representation exist?
    a
    • 2
    • 1
  • m

    Mateus Bauer

    10/07/2025, 1:54 AM
    Hi, folks! Has anyone solved this yet?
    Uncaught Kotlin exception: org.jetbrains.compose.resources.MissingResourceException
    I am facing this issue whenever I build the release XcFramework and try to run it. I don't know what's happening, since I am using the following settings(and that shoudn't happen):
    Copy code
    composeMultiplatform = "1.9.0"
    kotlin = "2.2.20"
    It was supposed to should work fine after CMP 1.8.2. Also, I can confirm that the resources are present in both simulator and arm64 frameworks, inside the XcFramework. I am running out of options, already read all things related and checked everything.
    i
    • 2
    • 24
  • k

    Kevin S

    10/09/2025, 5:01 PM
    Hi all! I'm running into a sizing / padding issue. I am using this calendar library in KMP and am passing it into a SwiftUI View. (The Calendars root view is a
    LazyRow
    ). I am then wrapping it in a
    ComposeUIViewController
    and then wrapping that in a
    UIViewControllerRepresentable
    on the Swift side. The problem is that I cannot get the height to fit. By default without any modifiers it doesn't show up at all. Then if use
    scaledToFit
    /
    scaledToFill
    there's a large space under the actual component. I've determined that the blank space underneath is on the SwiftUI side. I've tried various methods to get it working but nothing seems to work out well. The closest I got was following John O'Reillys post about it, which gets the correct height but has a long delay before showing the UI. Any suggestions? This is with Compose Plugin
    1.8.2
    .
  • e

    Ernestas

    10/10/2025, 8:30 AM
    Hey guys, have there been any news about liquid glass support on CMP?
    z
    j
    +5
    • 8
    • 28
  • j

    James Bowler

    10/15/2025, 4:34 AM
    Is there some trick for getting resources to work in ios archive? https://www.jetbrains.com/help/kotlin-multiplatform-dev/compose-multiplatform-resources-setup.html#what-s-next When I run my app, it works great, and my images are there on my iphone, but when i archive, and run, it crashes because it can't find them ..
    kodee happy 1
    • 1
    • 1