We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d17dd0b commit 913f944Copy full SHA for 913f944
subs/compose/src/main/java/com/engineer/compose/uitls/DelegateExample.kt
@@ -0,0 +1,19 @@
1
+package com.engineer.compose.uitls
2
+
3
+import kotlin.reflect.KProperty
4
5
+class Delegate {
6
+ operator fun getValue(thisRef: Any?, property: KProperty<*>): String {
7
+ return "$thisRef, thank you for delegating '${property.name}' to me!"
8
+ }
9
+ operator fun setValue(thisRef: Any?, property: KProperty<*>, value: String) {
10
+ println("$value has been assigned to '${property.name}' in $thisRef.")
11
12
+}
13
14
+fun main() {
15
+ var p by Delegate()
16
+ println(p)
17
+ p = "hello"
18
19
0 commit comments