Hi to all. I'm experimenting Compose for Ios and I...
# ios
c
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.
a
Not sure if there is a compose way, but you should be able to get this from the ios foundation libs. Something like UIDevice would probably give you this info
x
This might not be the best way to do this, but I hacked it like this. Source here