{"_id":"nodobjc","_rev":"6-2c969f16053b41d80feaa7a31f3667dd","name":"nodobjc","description":"The Node.js ⇆ Objective-C bridge","dist-tags":{"latest":"2.1.0"},"versions":{"2.0.0":{"name":"nodobjc","description":"The Node.js ⇆ Objective-C bridge","keywords":["obj","objective","c","mac","apple","ios","osx","cocoa","ffi","bridge"],"version":"2.0.0","author":{"name":"Nathan Rajlich","email":"nathan@tootallnate.net","url":"http://tootallnate.net"},"repository":{"type":"git","url":"git://github.com/TooTallNate/NodObjC.git"},"main":"./lib/index.js","scripts":{"test":"make test"},"dependencies":{"debug":"*","ffi":"~1.3.0","ref":"~1.0.1","ref-struct":"~1.0.1"},"devDependencies":{"libxmljs":"~0.7.1","dox":"0.3.x","memwatch":"*","highlight.js":"1","jade":"0.25.x","marked":"0.2.x"},"contributors":[{"name":"Nathan Rajlich","email":"nathan@tootallnate.net"},{"name":"Trevor Linton","email":"trevor.linton@gmail.com"}],"gitHead":"63bc2129537292240431a9767ed91299a80869c9","bugs":{"url":"https://github.com/TooTallNate/NodObjC/issues"},"homepage":"https://github.com/TooTallNate/NodObjC","_id":"nodobjc@2.0.0","_shasum":"1888cf8246fb0fd864d2c16bd77596d3dca0abe2","_from":".","_npmVersion":"2.7.4","_nodeVersion":"0.12.2","_npmUser":{"name":"tootallnate","email":"nathan@tootallnate.net"},"maintainers":[{"name":"tootallnate","email":"nathan@tootallnate.net"}],"dist":{"shasum":"1888cf8246fb0fd864d2c16bd77596d3dca0abe2","tarball":"https://registry.npmjs.org/nodobjc/-/nodobjc-2.0.0.tgz","integrity":"sha512-Z0725CLvEo+v6/llmfkQWRifhZwAvBs44jo+Z14HKpkzHI3QM3Q5ehdOl4wZ6SbF1K6KyLgGmOD1J1YhaRRlAw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDobgn84ckOwlD/s2/gFl3q5BTtYpRMz7as3aDCfIUKYwIgAfB/oj9Olt9Hth6GFL/vdsVRNNTqQzSUgmRMyKrLM2Y="}]}},"2.1.0":{"name":"nodobjc","description":"The Node.js ⇆ Objective-C bridge","keywords":["obj","objective","c","mac","apple","ios","osx","cocoa","ffi","bridge"],"version":"2.1.0","license":"MIT","author":{"name":"Nathan Rajlich","email":"nathan@tootallnate.net","url":"http://tootallnate.net"},"repository":{"type":"git","url":"git://github.com/TooTallNate/NodObjC.git"},"main":"./lib/index.js","scripts":{"test":"make test"},"dependencies":{"debug":"*","ffi":"2","ref":"~1.1.3","ref-struct":"~1.0.2"},"devDependencies":{"libxmljs":"~0.14.3","dox":"0.3.x","memwatch-next":"*","highlight.js":"1","jade":"0.25.x","marked":"0.2.x"},"contributors":[{"name":"Nathan Rajlich","email":"nathan@tootallnate.net"},{"name":"Trevor Linton","email":"trevor.linton@gmail.com"}],"gitHead":"13b287ac2f12ad65dbc8ff9494bc9ac119fa8286","bugs":{"url":"https://github.com/TooTallNate/NodObjC/issues"},"homepage":"https://github.com/TooTallNate/NodObjC#readme","_id":"nodobjc@2.1.0","_shasum":"df13ff30da31fd91b64b75f3175aeed05e8c579d","_from":".","_npmVersion":"3.3.12","_nodeVersion":"5.1.0","_npmUser":{"name":"tootallnate","email":"nathan@tootallnate.net"},"maintainers":[{"name":"tootallnate","email":"nathan@tootallnate.net"}],"dist":{"shasum":"df13ff30da31fd91b64b75f3175aeed05e8c579d","tarball":"https://registry.npmjs.org/nodobjc/-/nodobjc-2.1.0.tgz","integrity":"sha512-/MT2aSiRGXNzpm5Er/PkKVfTkBg4a0Z51jLJC7fVQ3uIRbhCigZnYCHcHmOVMC/bbAT0irhObRtlkBWwaMU1Vw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEbrqU4txf3hXGLL6JvFmd9rxkPAsNeQl9ugaICQrvGwAiEA1QoAv1BbadI+0To7nZImxB8DSS7Sq7viAU/s+voIzV8="}]}}},"readme":"NodObjC\n=======\n### The [Node.js][] ⇆ [Objective-C][ObjCWikipedia] bridge\n[![Build Status](https://travis-ci.org/TooTallNate/NodObjC.svg?branch=master)](https://travis-ci.org/TooTallNate/NodObjC)\n\n\n`NodObjC` exposes the Objective-C runtime to [Node.js][] in a high-level, easy\nto use fashion. It uses the `BridgeSupport` files to dynamically generate an\nAPI from an Objective-C \"Framework\", and uses the node `ffi` module to dynamically interact\nwith the Objective-C runtime.\n\nEssentially, `NodObjC` is similar in nature to the other popular Objective-C\nscripting bridges:\n\n * [JSCocoa][]\n * [PyObjC][]\n * [MacRuby][]\n * [And the others…][others]\n\nSo you can write entire Cocoa or iOS GUI applications entirely in Node.js\nJavaScript! Applications are interpreted at runtime through the V8 engine,\nrather than (pre)compiled to a (binary) machine exectuable. This has the advantage of being\nable to tweak code without having to recompile; excellent for rapid prototyping\nand development (or for those GUI applications where absolute speed is not a\nrequirement, i.e. _most_). So what are you waiting for? Get to coding!\n\n\nInstallation\n------------\n\nInstall using `npm`, of course!\n\n``` bash\n$ npm install nodobjc\n```\n\nOr add it to the `\"dependencies\"` section of your _package.json_ file.\n\n\nHello World\n-----------\n\n``` javascript\nvar $ = require('nodobjc')\n\n// First you import the \"Foundation\" framework\n$.framework('Foundation')\n\n// Setup the recommended NSAutoreleasePool instance\nvar pool = $.NSAutoreleasePool('alloc')('init')\n\n// NSStrings and JavaScript Strings are distinct objects, you must create an\n// NSString from a JS String when an Objective-C class method requires one.\nvar string = $.NSString('stringWithUTF8String', 'Hello Objective-C World!')\n\n// Print out the contents (toString() ends up calling [string description])\nconsole.log(string)\n//   → Prints \"Hello Objective-C World!\"\n\npool('drain')\n```\n\nBe sure to check out the [full API docs][docs].\n\n\nIntroduction\n------------\n\nThis module offers a bi-directional bridge between Node.js and the Objective-C\nruntime. What does that mean exactly? Well due to the design of the Objective-C\nruntime, it is possible to _port_ the entire API to other languages. There are\nquite a few bridges for Obj-C so one for node was a necessity.\n\nSo with this module, you get access to _all_ of the Objective-C APIs, but you\ninvoke them through JavaScript. Obj-C has a concept of \"message passing\" to\ninvoke methods on objects. The way that you pass messages around is probably a\nlittle bit different than the kind of JavaScript you're used to:\n\n``` javascript\n// In JavaScript, you invoke a function on an object like:\nobj.func(arg)\n```\n\nCompared to:\n\n``` javascript\n// In NodObjC, you send a message to an object like:\nobj('func', arg)\n```\n\nIn Objective-C, the names of methods are part of the arguments that you pass\nalong:\n\n``` objective-c\n[array insertObject: obj\n       atIndex: 5]\n```\n\nThe equivalent of the above message invocation in NodObjC syntax would be:\n\n``` javascript\narray('insertObject', obj,\n      'atIndex', 5)\n```\n\nSo the even numbered arguments are the parts of the method name that will be\ninvoked, and the odd numbered arguments are the Obj-C arguments themselves. In\nthe above example, the `insertObject:atIndex:` function will be invoked.\n\nIn `NodObjC`, not only is the Objective-C runtime exposed, but so are the\ncorresponding C functions that usually go along with these APIs (thanks to\nBridgeSupport). So for example, we can make an `NSRect` by calling the\n`NSMakeRect()` C function:\n\n``` javascript\n$.NSMakeRect(5, 10, 8, 30)\n// -> NSRect struct\n```\n\nThere's a plethora of other Objective-C resources and tutorials out there.\n\nYou should definitely have Apple's official [Mac][MacDev] or [iOS][iOSDev] API\ndocs handy at all times.\n\nSupport / Getting Involved\n---------------------------\n\nIf you're looking for support for developing with/for `NodObjC` you might want\nto join the [mailing list][group], and check out the [#nodobjc][IRC] channel\nin the Freenode IRC server.\n\nAdditional topics of discussion can be found on the [Wiki][] page.\n\n\n[docs]: http://tootallnate.github.io/NodObjC\n[group]: https://groups.google.com/d/forum/nodobjc\n[Node.js]: http://nodejs.org\n[JSCocoa]: http://inexdo.com/JSCocoa\n[PyObjC]: http://pyobjc.sourceforge.net\n[MacRuby]: http://macruby.org\n[IRC]: http://webchat.freenode.net/?channels=nodobjc\n[Wiki]: https://github.com/TooTallNate/NodObjC/wiki\n[MacDev]: http://developer.apple.com/library/mac/navigation/\n[iOSDev]: http://developer.apple.com/library/ios/navigation/\n[ObjCWikipedia]: http://en.wikipedia.org/wiki/Objective-C\n[others]: http://cocoadev.com/CocoaBridges\n","maintainers":[{"name":"tootallnate","email":"nathan@tootallnate.net"}],"time":{"modified":"2022-06-22T04:11:05.497Z","created":"2015-04-09T23:22:23.373Z","2.0.0":"2015-04-09T23:22:23.373Z","2.1.0":"2015-12-16T19:23:41.133Z"},"homepage":"https://github.com/TooTallNate/NodObjC#readme","keywords":["obj","objective","c","mac","apple","ios","osx","cocoa","ffi","bridge"],"repository":{"type":"git","url":"git://github.com/TooTallNate/NodObjC.git"},"contributors":[{"name":"Nathan Rajlich","email":"nathan@tootallnate.net"},{"name":"Trevor Linton","email":"trevor.linton@gmail.com"}],"author":{"name":"Nathan Rajlich","email":"nathan@tootallnate.net","url":"http://tootallnate.net"},"bugs":{"url":"https://github.com/TooTallNate/NodObjC/issues"},"readmeFilename":"README.md","license":"MIT","users":{"loknar":true,"laomu":true}}