how do i get screen Orientation in Ios I couldn't ...
# multiplatform
y
how do i get screen Orientation in Ios I couldn't figure it out
Copy code
actual fun Scope.isScreenLandscape(): Boolean {
    return true
}
j
Get the first window in
UIApplication
, and get its
windowScene
which has the
interfaceOrientation
y
got the first window like so :
Copy code
val mainWindow = UIApplication.sharedApplication.windows.firstOrNull()
and there is no such thing as windowScene
j
I have this in my project, hope this helps: val window = UIApplication.sharedApplication.windows.first() as? UIWindow return when (window?.windowScene?.interfaceOrientation) { UIInterfaceOrientationLandscapeLeft, UIInterfaceOrientationLandscapeRight -> { /* landscape */ } else -> { /* portrait */ } }
y
Thanks i appreciate it that