If I run the app for iOS the code within main.ios.kt is called twice:
Copy code
fun MainViewController() = ComposeUIViewController {
println("MainViewController")
App()
}
and my log output is:
Copy code
Debugger attached to process 44790
MainViewController
MainViewController
l
Landry Norris
09/11/2023, 4:49 PM
Composable functions can be called as many times as the Composer decides is necessary. Any side effects should be using LanchedEffect or some other Effect.
The ComposeUIViewController block is a composable lambda. Composable lambdas can be called any time the composer decides to. I know the ViewController handles some iOS state internally, so it's possible it decides to update some theme or something after the first composition, triggering another. This is what you are seeing, and is within allowed behavior for the composer.