Hi everyone, I want to implements Observable in ko...
# android
x
Hi everyone, I want to implements Observable in kotlin ,use this code ,
Copy code
kotlin fun <T> KProperty0<T>.addObserver(observer: (T) -> Unit) {
    (apply { isAccessible = true }.getDelegate() as MutableProperty<T>).addObserver(observer)
}
but I found Some mistakes appeared online, like this
Copy code
kotlin.reflect.full.IllegalPropertyDelegateAccessException: Cannot obtain the delegate of a non-accessible property. Use "isAccessible = true" to make the property accessible
can everyone help me