Summary
In this chapter, we learned how to write our first composables: top-level Kotlin functions that have been annotated with @Composable
. Composable functions are the core building blocks of Jetpack Compose-based UIs. You combined existing library composables with your own to create beautiful app screens.
To use Jetpack Compose in a project, both build.gradle
files must be configured accordingly. In this chapter, I showed you what these files should look like for a Compose app.
We also looked at how to preview and test a composable function. To see a preview, we can add the @Preview
annotation. We also saw how to deploy composable functions and Compose apps to the Android Emulator or real devices.
In Chapter 2, Understanding the Declarative Paradigm, we will take a closer look at the differences between the declarative approach of Jetpack Compose and the imperative nature of traditional UI frameworks such as Android’s view-based component library.