Hi guys, I have used compose multi-platform for sharing ui between android and iOS in my KMM library. I am using Precompose for handling navigation. The problem is that whenever I present my viewController, it does not respect the device safe area in iOS.
Adding some code sample below 👇
Abhishek Agarwal
09/06/2023, 11:31 AM
Copy code
private val topViewController: UIViewController?
get() {
var rootController = UIApplication.sharedApplication.keyWindow?.rootViewController
while (rootController?.presentedViewController != null) {
rootController = rootController.presentedViewController
}
return rootController
}
private val noobController: UIViewController by lazy {
PreComposeApplication { NoobScreen() }
}
fun toggle() {
if(!isNoobAlreadyShowing) {
noobController.modalPresentationStyle = UIModalPresentationFullScreen
topViewController?.presentViewController(noobController, true, null)
} else {
noobController.dismissViewControllerAnimated(true, completion = null)
}
isNoobAlreadyShowing = !isNoobAlreadyShowing
}
r
Rafs
09/06/2023, 4:21 PM
You are probably ignoring safe area in your swift file
a
Abhishek Agarwal
09/07/2023, 4:33 AM
In my ios app I just set rootViewController and call my KMM module’s
toggle
function
Abhishek Agarwal
09/08/2023, 10:03 AM
It would be really helpful if any of you guys can help me with this