October 2018
Intermediate to advanced
370 pages
9h 15m
English
Aside from user-defined delegates, the Kotlin library also provides some useful built-in delegates that can be used in our applications. One of these delegates is the observable delegate, which triggers when a value is assigned to the property.
The observable takes the following parameters:
The following example shows the observable delegate with the age and name properties of the Person class. This delegate observes the properties and is triggered every time the value of the property changes:
class Person { var age : Int ...Read now
Unlock full access