@johnfn, can I see the full code of how you did that please? would love to learn from it
j
johnfn
12/26/2018, 7:05 PM
Copy code
private lateinit var backingValue: T
var value: T
get() {
if (!::backingValue.isInitialized ) {
backingValue = build()
}
return backingValue
}
set(value) {
backingValue = value
}
johnfn
12/26/2018, 7:05 PM
build is the abstract method
johnfn
12/26/2018, 7:05 PM
though you have to remember to not call it from your constructor, which isn't totally ideal... eh