19 lines
631 B
Kotlin
19 lines
631 B
Kotlin
package app.klottr.platform
|
|
|
|
import androidx.compose.runtime.Composable
|
|
import androidx.compose.ui.platform.LocalDensity
|
|
import androidx.compose.ui.unit.Dp
|
|
import androidx.compose.ui.unit.dp
|
|
import platform.UIKit.UIScreen
|
|
import platform.CoreGraphics.CGRectGetHeight
|
|
|
|
@Composable
|
|
actual fun platformScreenHeightDp(): Dp {
|
|
// UIKit gives points; convert to Compose dp via LocalDensity for safety.
|
|
val heightPoints: Double = CGRectGetHeight(UIScreen.mainScreen.bounds)
|
|
val density = LocalDensity.current
|
|
// Compose dp ~= iOS points; still convert explicitly.
|
|
return with(density) { heightPoints.toFloat().dp }
|
|
}
|
|
|