Skip to content

Instantly share code, notes, and snippets.

Last active Jan 9, 2016
What would you like to do?
Kotlin ViewBinder for Android
* View binder with nullable types support
class ViewBinder<M>(val function: (M) -> Unit) : ReadWriteProperty<Any, M> {
private var mValue: M? = null
override fun getValue(thisRef: Any, property: KProperty<*>): M {
return mValue as M
override fun setValue(thisRef: Any, property: KProperty<*>, value: M) {
mValue = value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment