Do you ever wish you could just directly change yo...
# feed
c
Do you ever wish you could just directly change your application state at run-time, maybe to recreate a strange bug or quickly see how the UI looks in a particular state without recompiling? Wouldn’t it be great if you could just describe your UI state as JSON and magically see it reflected in your application in real-time? With the latest version of Ballast MVI, you get this for free with almost no changes to how you already build your Compose/Ballast UI! Along with supporting Kotlin 1.9, the new Debugger Intellij Plugin allows you to send States and Intents as JSON, directly from your IDE to the running application. You can watch an example in

this video

, or install the Ballast Intellij Plugin and try it out immediately in this docs page example.
🔥 3
👍 1
👍🏾 1
If you have any questions about Ballast or how to set up and use the new debugger, please join the #ballast for support and to keep up with the latest updates of the Ballast library.
s
Cool! Will it also work for complex state? E.g:
Copy code
data class Book(
    val id: String,
    val title: String,
)

data class State(
    val books: List<Book> = emptyList()
)
How should I define the JSON for this and how would you parse it?
c
Yup, it works for any state, how it gets (de)serialized is fully up to your application (and can even work with alternative serialization formats if you need). The simplest way is to use the #serialization library and mark your state as
@Serializable
, as you can get it configured simply by passing the generated serializers to the ViewModel configuration. You can see the basic setup in the Web example ( state serialization, viewModel configuration). I still need to update the docs page to show the full setup, but you can also use other serialization libraries as well. The API basically gives you the serialized String, and you can convert it to your State/Inputs however you need
Updated documentation for configuring the Debugger for serialization is now available here.
🙌 1
thank you color 1