Created
August 22, 2022 21:08
-
-
Save mherod/c42c1a090ae5d66de44d86a826cb3a9e to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| import kotlin.properties.ReadWriteProperty | |
| import kotlin.reflect.KMutableProperty0 | |
| import kotlin.reflect.KProperty | |
| inline class PropertyAlias<T>(val delegate: KMutableProperty0<T>) : ReadWriteProperty<Any?, T> { | |
| override operator fun getValue(thisRef: Any?, property: KProperty<*>): T = delegate.get() | |
| override operator fun setValue(thisRef: Any?, property: KProperty<*>, value: T) = delegate.set(value) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment