By using ObjC.bindFunction
in JXA, we can obtain an integer result from objc_getClassList
.
Does anyone understand the types and bridging issues well enough to find a route to getting a list of class name strings returned by objc_getClassList
into the JavaScript for Automation JSContext ?
(The code below returns only an [Object Ref]
string)
(() => {
'use strict';
ObjC.import('stdlib');
ObjC.bindFunction('CFMakeCollectable', [ 'id', [ 'void *' ] ]);
ObjC.bindFunction('objc_getClassList', ['int', ['void *', 'int']]);
var classes = Ref();
const intClasses = $.objc_getClassList(null, 0);
$.objc_getClassList(classes, intClasses);
$.CFMakeCollectable(classes);
return [intClasses, classes];
//-> [11411, [object Ref]]
})();