https://kotlinlang.org logo
j

Jozef Matus

01/03/2021, 3:01 PM
Hi guys, did anybody create subclass of UILabel in kmm? I don’t know how to work around designated constructor defined in kotlin
@kotlinx.cinterop.ObjCConstructor public constructor(frame: kotlinx.cinterop.CValue<platform.CoreGraphics.CGRect>) { /* compiled code */ }
as you can see, it expects
CValue<CGRect>
I found out that to create CValue type I have to use
fun <reified T : CStructVar> cValue(initialize: T.() -> Unit): CValue<T>
but still, Im not able to create CValue<CGRect>. This is what I have right now:
Copy code
val test = cValue<CGRect> {
    size = CGSizeZero // Val cannot be reassigned 
}