electrolobzik
12/24/2023, 7:09 PMelectrolobzik
12/24/2023, 7:11 PMclass MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val rootComponent =
DefaultRootComponent(
componentContext = defaultComponentContext(),
)
enableEdgeToEdge()
setContent {
App(rootComponent = rootComponent)
}
}
}
electrolobzik
12/24/2023, 7:12 PMfun MainViewController() = ComposeUIViewController {
App()
}
electrolobzik
12/24/2023, 7:26 PM@OptIn(ExperimentalDecomposeApi::class)
fun MainViewController(): UIViewController {
val rootComponent =
DefaultRootComponent(
componentContext = DefaultComponentContext(lifecycle = ApplicationLifecycle()),
)
return ComposeUIViewController {
App(rootComponent = rootComponent)
}
}
Arkadii Ivanov
12/24/2023, 7:37 PMArkadii Ivanov
12/24/2023, 7:39 PMMainViewController
function multiple times (e.g. in different parts of the app) without realising that it attaches the component to the application lifecycle.electrolobzik
12/24/2023, 7:53 PMMainViewController
function. I am new to iOS development with KMM and don’t see any references.. =)