Native application entry points
While Compose Multiplatform UI can be implemented in common code entirely, actual applications start from native entry points. These entry points are where you can alter the platform-specific behavior of your apps.
For example, in the basic project generated by the KMP IDE wizard, the base of the UI is the App() function in common code. This function is then called on each platform:
On Android, the call is managed by an activity.
On iOS, by a view controller.
On the desktop, by a window.
On the web, by a container.
On Android
For Android, the call is made from within the setContent() lambda in the Android activity called MainActivity:
Compose Multiplatform provides access to all Jetpack Compose APIs, but some of them are only available for Android apps.
On iOS
For iOS, the common App() composable is called within a view controller that performs the same role as an activity on Android:
Both the iOS view controller and Android activity simply invoke the App() composable from common code.
For more on Compose Multiplatform integration with iOS UI frameworks, see Integration with the SwiftUI framework and Integration with the UIKit framework.
On desktop
On desktop, Compose Multiplatform is built into a JVM app. The call to the common App() composable is made in the main() function, wrapped in an application() (or a singleWindowApplication()) call:
Typically, within the application() function, you create a Window, specify its properties, and define with an onCloseRequest callback what happens when the window is closed. In the default project, the whole application shuts down (::exitApplication).
As with Android and iOS, the App() composable is responsible for the entire UI layout.
Learn more about desktop-specific Compose Multiplatform components and Swing interoperability.
On web
The web application, whose code is located in the webApp module in the default project, calls the common App() composable from the main() function in the main.kt file:
For more on the web entry point, see Setting up the viewport.
Get help
Kotlin Slack: Get help and participate in discussions about KMP and Compose Multiplatform. Request an invitation and join the #multiplatform and #compose channels.
Kotlin issue tracker: Report a new issue.