I'm struggling to use pointers properly with Kotli...
# kotlin-native
s
I'm struggling to use pointers properly with Kotlin/native in ObjC interop. I found a SO post with clear ObjC / Swift instructions to use an API, and I'm struggling to replicate in Kotlin: https://stackoverflow.com/a/48030215/471744
val windowInfoList = CGWindowListCopyWindowInfo(kCGWindowListOptionAll, kCGNullWindowID)!!
windowInfoList
is of type
CFArrayRef
, and no matter what I do I can't figure out how to use it / get at the items in the array. Any help would be appreciated. Here is the documentation for the function: https://developer.apple.com/documentation/coregraphics/1455137-cgwindowlistcopywindowinfo
a
Had similar issue with toll-free bridging: https://github.com/JetBrains/kotlin-native/issues/1737 I worked around it. I'd like to know how to bridge a CF type to NS type too.
s
Swift / ObjC seems to be able to get values out just fine. I'd assume Kotlin has a way to as well. Part of the problem is I'm a little out of my comfort zone working with pointers, and the other part is the documentation around interop isn't very helpful here.
@olonho Why can Swift / ObjC interact with these components easily, but I'm forced to use the C API in Kotlin?