I’m trying to use the
CGRectMake API from platform.CoreGraphics within an
actual class in my iosMain. It requires CGFloat instead of floating point literals(FPL). When I use FPLs I get the error:
the floating-point literal does not conform to the expected type CGFloat.
The problem is that not only does there not seem to be a bridge between scalar types from Kotlin to ObjC, but also that there isn’t even a way to create a CGFloat value, since CGFloat (as defined in platform.CoreGraphics) does not have any constructors. Calling:
val x = CGFloat(5.0) results in error: Expected class CGFloat does not have default constructor.
I’ve looked at sample code here, and I’m not sure how they’ve gotten it to work.
Is there something I’m missing in order to get Kotlin Float to play nice with CGFloat?