Is there some problem with manipulating objective-...
# ios
m
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?
s
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.
m
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, (https://stackoverflow.com/questions/71078451/viewing-complex-objects-in-debugger) that it's probably something to do with your idea.
@Sam???