https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
c

Carlo De Chellis

05/31/2023, 2:54 PM
Hi to all. I'm experimenting Compose for Ios and I would like to know, is there a way to achieve real time WindowSize just like the android composable like this:
Copy code
@Composable
private fun Activity.rememberWindowSize(): WindowSize {
    val configuration = LocalConfiguration.current
    val windowMetrics = remember(configuration) {
        WindowMetricsCalculator.getOrCreate().computeCurrentWindowMetrics(this)
    }
    val windowDpSize = with(LocalDensity.current) {
        windowMetrics.bounds.toComposeRect().size.toDpSize()
    }
    return WindowSize.basedOnWidth(windowDpSize.width)
}
? Thanks in advance.
p

Pablichjenkov

05/31/2023, 2:58 PM
You can also ask here #compose-ios
3 Views