Guy Bieber
04/29/2020, 6:01 PMdata class VertTempControl (
var temp : Int = 72,
var step : Int = 1
) : Control()
...
@Model
data class DataModel (
var username : String = "dude",
var password : String = "blah",
var oldPage : Pages = Pages.SPLASH_PAGE,
var newPage : Pages = Pages.SPLASH_PAGE,
var temperature : Int = 72
)
var dataModel = DataModel()
...
var vt = VertTempControl(
temp = dataModel.temperature,
step = 1
)
...
showControl (vt)
Zach Klippenstein (he/him) [MOD]
04/29/2020, 6:08 PMvar vt = VertTempControl
etc is inside a composable function. In that case, compose will see that you're reading a property on dataModel
and will re-invoke your function when that property changes, which will recreate your VertTempControl
object with the new value, pass it to showControl
again, etcdataModel
should probably be a val
since it is itself mutable.Guy Bieber
04/29/2020, 6:13 PM