https://kotlinlang.org logo
Title
t

tjohnn

03/17/2020, 10:26 AM
Does this idea of screen state make sense? I want to emit an empty screen state from viewmodel to ui and the screen state has a kotlin lambda inside of it for a call back when a button is clicked. E.g:
data class (
    val message: String,
    val callback: () -> Unit
)
k

KamilH

03/17/2020, 5:13 PM
Yes it makes sense, I have similar approach in my apps and it works well Small tip: As I’m using a lot of
() -> Unit
types, I created a following alias to avoid writing the same over and over again:
typealias Callback = () -> Unit
t

tjohnn

03/17/2020, 6:28 PM
That’s great @KamilH . Thanks