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

xxfast

03/22/2023, 12:03 AM
Anyone figured out a nice way to provide
WindowInset
for ios targets?
Currently i have
Copy code
expect val WindowInsets.Companion.statusBars: WindowInsets

expect val WindowInsets.Companion.navigationBars: WindowInsets

//iosMain
actual val WindowInsets.Companion.statusBarPadding: WindowInsets get() = WindowInsets(top = 48.dp)

actual val WindowInsets.Companion.navigationBarPadding: WindowInsets get() = WindowInsets(bottom = 8.dp)

//androidMain
import androidx.compose.foundation.layout.navigationBars
import androidx.compose.foundation.layout.statusBars
actual val WindowInsets.Companion.statusBars: WindowInsets
  @Composable get() = WindowInsets.statusBars

actual val WindowInsets.Companion.navigationBars: WindowInsets
  @Composable get() = WindowInsets.navigationBars
but this assumes the dynamicisland/notch has the same size (which it doesnt)
d

darkmoon_uk

03/22/2023, 12:09 AM
...same size between different iOS devices you mean?
I think you want to use values from
<UIWindow>.safeAreaInsets
in your
iosMain
t

Tlaster

03/22/2023, 2:53 AM
You can checkout https://github.com/Tlaster/SafeArea as example
35 Views