Created
April 25, 2021 05:12
-
-
Save Urdzik/337ee74d2759c44f0b234400dfc79229 to your computer and use it in GitHub Desktop.
Kotlin Delegated (View)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun TextView.text(): ReadWriteProperty<Any, String> = | |
object : ReadWriteProperty<Any, String> { | |
override fun getValue( | |
thisRef: Any, | |
property: KProperty<*> | |
): String = text.toString() | |
override fun setValue( | |
thisRef: Any, | |
property: KProperty<*>, value: String | |
) { | |
text = value | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment