var $ = require('NodObjC'); // First you need to "import" the Framework $.import('Foundation'); // Setup the recommended NSAutoreleasePool instance var pool = $.NSAutoreleasePool('alloc')('init'); // NSStrings and JavaScript Strings are distinct objects, you must create an // NSString from a JS String when an Objective-C class method requires one. var string = $.NSString('stringWithUTF8String', 'Hello Objective-C World!'); // Print out the contents (calling [string description]) console.log('%s', string); // → Prints "Hello Objective-C World!" pool('drain');
Source: https://habr.com/ru/post/127736/
All Articles