Build Android and iOS apps with Compose Multiplatform (CMP)
I am sure you have heard about Compose Multiplatform, but let’s see how to use it. But in case you did not hear about it, Compose Multiplaftorm is a Kotlin framework that uses Jetpack Compose to build cross-platform apps.
Creating the project
To create a new project we need to use the Kotlin Multiplatform wizard. These are my settings, then hit the download button.
After that open the project in your IDE either Fleet or Android Studio and open the commonMain
package. Here we will write some code in the App.kt
file.
Now let’s create a LazyVerticalGrid
with 2 fixed columns and 10 items.
@Composable
@Preview
fun App() {
MaterialTheme {
LazyVerticalGrid(columns = GridCells.Fixed(2)) {
items(10) {
// ...
}
}
}
}
In this grid, we will display images, so to do that we will use a library called Compose ImageLoader…