Delegated properties | Kotlin Documentation
Property delegates don’t have to implement an interface, but they have to provide a getValue() function (and setValue() for vars).
val answer: Int by lazy { println("Computing the answer to the Ultimate Question of Life, the Universe, and Everything") 42}println("What is the answer?")// Will print 'Computing...' and then 42println(answer) // 42println("Come again?")// Will just print 42println(answer) // 42
Observable Properties
listeners are notified about changes to this property.
The handler is called every time you assign to the property (after the assignment has been performed). It has three parameters: the property being assigned to, the old value, and the new value: