# ios


02/14/2022, 11:44 AM
Is there some problem with manipulating objective-c classes from Kotlin? I'm sure the answer should be "no", but I'm getting nowhere with creating and manipulating CGMutablePaths. The code doesn't throw errors, I can watch it run in the (XCode) debugger, but the paths never seem to acquire any elements. The variable window shows my CGmutablePath variable as "(void **)". which is worrying, but below that shows it as "(__NSCFType *)", and both with "Summary Unavailable". However, both show memory locations as if something has been allocated... Any ideas?


02/14/2022, 6:21 PM
Can you post some sample code? Those structs have creation functions in ObjC which if memory serves, map a little differently to Kotlin than is obvious.


02/14/2022, 6:37 PM
I'll try. I hope I don't leave out anything important, 'cos there's a lot of fiddling around to make this cross platform. I have a Kotlin class to encapsulate this, MmPath. It can't inherit from CGPath because that's final in the iOS world. It's much easier on the Android side. The iOs versoin has a property thePath
Copy code
private var thePath = CGPathCreateMutable()
"Standard" operations are (still) pretty simple to code, for example
Copy code
fun moveTo(x: Float, y: Float) {
        CGPathMoveToPoint(thePath, scaling, x.toDouble(), y.toDouble())
So I can (ie "hope to") create and use a path as (eg)
Copy code
var aPath = MmPath()
aPath.moveTo(50F, 50F)
Noticing other class properties that I know are null (in a particular instance), they too have associated addresses, and I see that objective-c doesn't allow nulls, so presumably the path is getting created, but nothing is added to it... ?
@Sam, got any help on those mappings? It seems to me, having had some extensive discussion with ObjC folks, ( that it's probably something to do with your idea.