Wenn Szenen eingeführt werden, wird die Top -Systembar -Polsterung verdoppelt oder irgendwie größer als erwartet: < /p>
AppDelegate.swift:
Code: Select all
import Foundation
import UIKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
}
< /code>
erscenedelegate.swift:
import Foundation
import UIKit
import ComposeApp
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else {
return
}
window = UIWindow(frame: windowScene.screen.bounds)
window?.windowScene = windowScene
window?.rootViewController = UINavigationController(rootViewController: MainViewControllerKt.MainViewController())
window?.makeKeyAndVisible()
}
}
< /code>
MainViewController.kt (im Kotlin -Multiplattform -Modul): < /p>
import androidx.compose.ui.window.ComposeUIViewController
fun MainViewController() = ComposeUIViewController { App() }
< /code>
app.kt (im Kotlin -Multiplattform -Modul): < /p>
@Composable
@Preview
fun App() {
Box(modifier = Modifier
.fillMaxSize()
.systemBarsPadding()
.background(Color.Yellow)
)
}