ApplesauceOS
Read Markdown ↗Download .md

ObjC.create

Allocate and initialize a native object.

js
ObjC.create(className, initializer = "init", ...args)

Arguments

ArgumentTypeMeaning
classNamestringClass to allocate.
initializerstringInit-family selector; default init.
argsanyInitializer arguments.

Returns

Initialized object proxy, or null for nil.

Example

js
const object = ObjC.create("NSMutableDictionary");
object.call("setObject:forKey:", "Hello", "message");
console.log(object.toJS());
object.release();

Notes

Start with Objective-C step by step. Also available on app = RemoteObjC.forApp(bundleId) as app.create().

All JavaScript APIs · Automation playbook