https://kotlinlang.org logo
#compose-ios
Title
# compose-ios
h

Henri Gourvest

10/20/2023, 11:01 AM
So, I recorded two videos on Android and IOS that show the difference in motion rendering. The frame rate seems to be lower on IOS, while the other applications are perfectly fluid. I know that Compose IOS is in Alpha, but I'd like to know if this is a problem that's considered important or not. Because for the type of application I want to develop, it's crucial.
i

Ivan Matkov

10/20/2023, 3:40 PM
Thanks for looking at it! Could you please send a report with reproduction sample here? https://kotlinlang.slack.com/archives/C0346LWVBJ4/p1691063974417639
h

Henri Gourvest

10/22/2023, 1:29 PM
I've created a component that eats frames to count them. This had the effect of masking my problem and making the application run perfectly smoothly. Unfortunately, I can't share my code as it is, so I'll try to remove as much code as I can until I completely understand the problem.
Copy code
@Composable
fun EatFrames() {
    var count by mutableStateOf(0)
    var mark by mutableStateOf(TimeSource.Monotonic.markNow())
    var rate by mutableStateOf(0)
    val textMeasurer = rememberTextMeasurer()
    val precision = 120
    Canvas(Modifier.width(32.dp).height(24.dp).background(Color.Green)) {
        if (count == precision) {
            rate = (1000 * precision / mark.elapsedNow().toLong(DurationUnit.MILLISECONDS)).toInt()
            count = 0
            mark = TimeSource.Monotonic.markNow()
        } else
            count++
        drawText(textMeasurer = textMeasurer, text = "$rate")
    }
}
👍 2
thank you color 2
👍🏻 1
2 Views