Objective-C bridge for Node.js
npm install objc-jsobjc-js is an Objective-C bridge for Node.js. This is a fork of nobjc by Noah Gregory.
- Node.js / Bun
- Xcode Command Line Tools (Run xcode-select --install to install)
- pkg-config from Homebrew (Run brew install pkgconf to install)
> [!NOTE]
> Why are these prerequisites required?
>
> These are required to rebuild the native code for your system.
``bash`
npm install objc-js
`bashbun pm trust -a
bun add objc-jsand
to run the rebuild if needed`
The documentation is organized into several guides:
- Basic Usage - Getting started with loading frameworks and calling methods
- Subclassing Objective-C Classes - Creating and subclassing Objective-C classes from JavaScript
- Protocol Implementation - Creating delegate objects that implement protocols
- API Reference - Complete API documentation for all classes and functions
`typescript
import { NobjcLibrary } from "objc-js";
// Load a framework
const foundation = new NobjcLibrary("/System/Library/Frameworks/Foundation.framework/Foundation");
// Get a class and call methods
const NSString = foundation["NSString"];
const str = NSString.stringWithUTF8String$("Hello, World!");
console.log(str.toString());
``
For more examples and detailed guides, see the documentation.