diff --git a/common/src/commonMain/kotlin/net/dankito/utils/multiplatform/ObjectReference.kt b/common/src/commonMain/kotlin/net/dankito/utils/multiplatform/ObjectReference.kt new file mode 100644 index 00000000..d0d41352 --- /dev/null +++ b/common/src/commonMain/kotlin/net/dankito/utils/multiplatform/ObjectReference.kt @@ -0,0 +1,21 @@ +package net.dankito.utils.multiplatform + + +open class ObjectReference( + value: T?, + open val valueChangedListener: ((T?) -> Unit)? = null +) { + + open var value: T? = value + set(value) { + field = value + + valueChangedListener?.invoke(value) + } + + + override fun toString(): String { + return "$value" + } + +} \ No newline at end of file