Hi, I'm having trouble with properties in `expect ...
# multiplatform
l
Hi, I'm having trouble with properties in
expect value
classes. I'm trying to create a multiplatform
Color
class, backed by Compose's Color class in the jvm target.
Copy code
// android module
actual typealias Color = androidx.compose.ui.graphics.Color
Compose
Color
class contains getter for color components.
Copy code
// Compose's Color class
@kotlin.jvm.JvmInline
value class Color(val value: ULong) {
    
    val red: Float
        get() {
           ...
        }
}
I would like to put these getters into my expected
Color
class and can't seem to find the correct syntax that would allow me to do it (see the attached image).
t
not sure if that can be fixed easily, but an alternative is to expect extension properties for
red
,
blue
etc
d
You could also define those properties in an interface and have
Color
extend that interface. The
actual
definitions would then have to implement them.