kotlin.properties.Delegates.vetoable

vetoable

inline fun <T> vetoable(
    initialValue: T, 
    crossinline onChange: (property: KProperty<*>, oldValue: T, newValue: T) -> Boolean
): ReadWriteProperty<Any?, T>

Returns a property delegate for a read/write property that calls a specified callback function when changed, allowing the callback to veto the modification.

Parameters

initialValue - the initial value of the property.

onChange - the callback which is called before a change to the property value is attempted. The value of the prope