Functional UI toolkit for Jetpack Compose, inspired by Halogen.
Iodine is a functional UI toolkit for Kotlin built on top of Flow, Jetpack Compose, and Arrow. Where Arrow intends to be a "Functional companion to Kotlin's Standard Library", Iodine aims to be a functional companion to Jetpack Compose (including for desktop and multi-platform).
A question that might come to mind when first learning about Iodine is: What advantages does it provide over pure compose? Isn't compose already a perfectly good declarative UI framework, why do we need another layer on top of that?
The answer to that is multi-fold:
- Iodine, together with some other projects, provides the capability to easily create and use forms for the validation and entry of Kotlin data classes.
- Iodine provides various utility functions for common UI and databinding patterns, such as a drop-down list selection widget which displays some visual representation (say a name) of a more complex strucuted object that is being selected under-the-hood.
- Iodine builds on top of composable functions to allow architecting user interfaces in terms of components, which allows explicitly specifying how the state of the component updates based on the input events to the component, as well as what kind of events the component itself can output, and provides a useful re-usable/plugable bundle of UI and buisness logic (similar to Decompose) which still internally maintains a clear seperation of presentation (view) and buisness logic.
- The explicit specification of the API of components that Iodine allows allows for highly flexible ways of abstracting out various UI design patterns to reduce coupling between different aspects of the UI design, as well as allowing for particularly nice APIs to be designed for plugin systems where the UI of a base application is extensible by said plugins.
- Iodine's architecture allows for particularly easy testing of UI logic.
To get started with Iodine, clone this project and run gradlew :core:jar :desktop:jar
to build the iodine-core
and iodine-desktop
jar
s needed for a Compose for Desktop
project, then, place these in the libs
folder of your project, and add the following
to your build.gradle.kts
:
dependencies {
...
implementation(files("$projectDir/libs/iodine-core.jar"))
implementation(files("$projectDir/libs/iodine-desktop.jar"))
...
}
An example of this can be found in the compose for desktop project example.
Similarly, to get started with an Android project, you can run gradlew :core:jar :android:build
,
place the built jar and aar in the libs
folder of your project, and add the following
to your build.gradle.kts
:
dependencies {
...
implementation(files("$projectDir/libs/iodine-core.jar"))
implementation(files("$projectDir/libs/iodine-android.aar"))
...
}
An example of this can be found in the android project example.
If you use Iodine, or find it useful, consider supporting it's development efforts by buying me a coffee ☕, or a beer 🍺!
For a more comprehensive tutorial, visit the project page for Iodine, or, if you would prefer to dig straight into the KDocs, you can find those here. For a quick introduction, continue reading!